United Nations, N.Y. — Morocco's King Hassan II is at the crossroads. He can choose between a practical alliance with Libya's Muammar Qaddafi or a strategic partnership with Algeria's Chadli Benjedid. Alliance with Qaddafi offers King Hassan safety in the short run, but a long-run danger - that the war over control of the Western Sahara would continue, with its economic and political damages to Moroccan stability.
A Moroccan-Algerian partnership, on the other hand, could take Hassan on a rocky road to an eventual promising political stability and economic prosperity.
Top-secret, high-level direct and indirect negotiations between all the parties concerned with the Western Sahara problem are now being conducted. It could lead to a breakthrough ''to a UN supervised referendum in the Western Sahara,'' according to a well-placed source.
As the 38th General Assembly of the United Nations prepares to take up the question of the Western Sahara, Morocco's diplomatic position is gradually eroding.
The eight-year-old desert war between Morocco and the Polisario guerrilla front has reached a stalemate, with neither side capable of achieving a decisive victory over the other.
Meanwhile, at its June summit at Addis Ababa, Ethiopia, the Organization of African Unity (OAU) for the first time adopted a resolution calling for direct negotiations between Morocco and the Polisario. It also called for a UN-supervised referendum to be held by December to let the Saharan people decide whether to remain Moroccan or whether to create their own independent nation.
From 1975 to 1980 the General Assembly passed two resolutions every year, one sympathetic to the Polisario and one which took Morocco's point of view into account. Last year, for the first time, only one pro-Polisario resolution was adopted. This year the General Assembly is expected to adopt only one resolution , which will take its cue from the OAU decision and ask Morocco to hold a referendum and negotiate face-to-face with the Polisario.
There is evidence that Hassan would like to settle the problem once and for all. His summit meeting last February with Algeria's President Chadli clearly indicated that both Algeria and Morocco wished to put the problem behind them. This would pave the way for improved relations with each other and with Tunisia, allowing them to form a closely knit Maghreb, capable of resisting the pressures of both superpowers and of remaining nonaligned.
''There are several ways which would allow Hassan II to soften his stance without losing faith,'' says a diplomat familiar with the situation. ''Instead of negotiating directly at the top, with the Polisario, he could first allow his own Saharoui refugees to talk to the Saharouis who are based in Algeria.
''Ultimately, if he talked to the Polisario, the latter might well in the end settle for less than it demands today. In 1972, Sudan's (President Jaafar) Nimeiry finally agreed to negotiate with the Anya-Nya (southern Sudan's separatist movement) and the latter settled for a large autonomy rather than for secession,'' the diplomat pointed out.
The United States, which gives Morocco military and diplomatic support, is thought to be encouraging Hassan to seek a compromise solution. So is France, which has close ties to Algiers and Rabat.
''Hassan is tempted, but he is scared,'' says one analyst. ''He runs the risk of being toppled if he continues a war that cannot be won - and if he stops it and frustrates the nationalist feeling.''
In the short run, he may gain some tactical advantage by enlisting Qaddafi's support. Oddly, Libya's fiery Qaddafi is now supporting Hassan, whom he had previously opposed.
Hassan's former Libyan enemy offers him a deal: ''You (Hassan) support my claims over Chadian territory and I'll stop supporting the Polisario against you.''
This unlikely alliance between the pro-Western monarch and the unpredictable Qaddafi could provide Morocco with a breathing spell, but it would not replace a viable long-term strategy for Morocco, according to diplomatic sources. Some moderate French African states like Senegal, which have long stood behind Morocco, are now moving closer to Algeria.