In a political realignment that could lead to a widening of the Saharan war, this desert nation's military government has moved closer to closer to its radical North African neighbors, Algeria and Libya, in response to perceived threats from Morocco.

But Mauritania's military leader emphatically denies that his government has opened a second war front against Morocco, the United States' principal allay in the region, by siding with Algerian-backed Polisario guerrillas in their 6-year-old conflict in the Western Sahara.

In an interview, Lt. Col. Mohammed Khouna Haidalla repeatedly dismissed charges of Mauritanian complicity with Polisario as "false" and said the allegations have been purposely fabricated by "the expansionist supported by particulary well-informed Western analysts who referred to recent Western military surveillance of northern Mauritania's desert region where guerrilla bases are said to be located.

Western military intelligence concluded recently that Moroccan allegations of Polisario based on Mauritanian soil "are not true to the best of our knowledge," said one analyst.

Three times Haidalla responded "that is false" when asked specifically about reports that Libyan, East German and Cuban troops were aiding Polisario guerrillas at Mauritanian bases, that the guerrillas had a base 100 miles due north of here, that the Libyans were supplying Polisario with arms along the so-called Qaddafi Trial in northeast Mauritania's Chegga region and that, in withdrawing from the Western Saharan war in 1979, Mauritania secretly ceded part of its territory to Polisario.

Haidalla said Mauritania does support the Western Saharan people's right to self-determination, but has not, as has been widely reported, recognized Polisario's Saharan Arab Democratic Republic as a sovereign country.

At last year's Organization of African Unity summit in Sierra Leone, after a bitter debate, a majority of the 50 member states voted to admit the Saharan Republic as a member because Morocco has turned a deaf ear to repeated calls for a U.N-supervised referendum in the disputed territory. The issue, however, was shelved after Morocco and 12 other African states threatened to quit the QUA if Polisario were admitted. Nevertheless, it is expected to come up again at next month's summit in Kenya.

Algeria has openly supported Polisario with bases and supplies since the beginning of the conflict in 1975 and Libya reportedly stepped up its assistance to the guerrillas in recent months. Polisario, several observers noted, has increased its attacks on Moroccan troop positions in the Western Sahara, adding to Morocco's estimated $1-million-a-day cost of the war. One European diplomat here said the conservative Saudi monarchy, which views Polisario, Algeria and Libya as "dangerous, "ommunist-influenced radicals," is substantially underwriting Morocco's war effort.

The war is over a sparsely inhabited, phosphate-rich , 200-square-mile desert territory that was ruled by Spain until six years ago. In November 1975, Spain, under Moroccan pressure, ceded what was then the Spanish Sahara to Morocco and the Mauritanian government of Moktar Daddah. The Mauritanians suffered heavy loss of life and saw their meager financial resources depleted, and three years later the unpopular war led to Daddah's overthrow in a bloodless Army coup.

Mauritania's new military rulers quickly sued for peace and withdrew the nation's troops from the southern third of the Western Sahara, which was promptly occupied by Moroccan troops. It has tried, Haidalla said, to stay outside and direct involvement in the fighting since signing a 1979 peace treaty with Polisario.

The latest phase of the conflict began in the predawn darkness of March 16 when a band of 10 soldiers led by exiled Mauritanian officers of the Moroccan-based Alliance for a Democratic Mauritania, slipped into Mauritania from Senegal in two Land Rovers. At 10 a.m., they attacked the presidential executive building in Nouakchott in a fruitless effort to capture Haidallah and the 20-man ruling Military Committee for National Salvation.

None of the targeted leaders was in the building, but eight people were killed, including one civilian, and seven were wounded. Of the attackers, the four leaders were executed, five were jailed for life and one escaped.

Mauritania immediately charged the Moroccan government of King Hassan with supporting the coup attempt. Morocco denied the charge, but Mauritania broke diplomatic relations, and within 48 hours began receiving planeloads of Algerian arms in Soviet-built Antonov-12 troop carriers at Nouakchott's airport. At least 15 airplane deliveries and one shipload of weapons had arrived by early April.

Algeria, which had broadcast vague charged of imminent aggression against Mauritania by Morocco days before the coup attempt, "had to have been reading those deliveries for some time," said a source konwledgeable about the region. "Their bureaucracy is too cumbersome to have allowed them to pull that off in two days," the source added.

One informed observer here credits the Mauritanians with maintaining their neutrality in the conflict, but added that Haidalla, 40, who was born in the border area between Western Sahara and Mauritania, "has never hidden his pro-Polisario sentiments. Haidalla, several top members of his government and a large proportion of the Mauritanian population have ethnic and regional ties to the Polisario guerrillas.

The colonial-drawn borders of northern Mauritania, southeastern Algeria, southern Morocco and the eastern part of Western artifically divide desert nomads who have blood and tribal ties. Many are descendants of the Beni Hassan Yemeni Bedouins who migrated into the region between the 13th and 17th centuries. The same region, like the Polisario organization itself, is dominated by desert tribes of the several-centuries-old Reguibat confederation of warrior Moors, mixed decendants of Arabs and Berbers.

"All nature of ties between the Mauritanian people and the [Western] Saharans," said Haidalla. "And it is precisely because of these ties that we have always characterized the Saharan war as fractricidal and absurd," Haidalla added.

Mauritania is anxious to stay out of the war because of the exposed position of its iron ore mines near the northern town of Zouerate close to the Western Saharan border and Morocan troops. Iron ore exports make up more than 85 percent of this country's small annual export earnings of $160 million. The Mauritanians do not want to give the Moroccans a reason to invade on a "hot pursuit" mission after guerrillas.

Algeria apparently has given assurances to Mauritania about future military assistance in any conflict with Morocco. informed sources said. Haidalla did not deny that some Algerian assurances have been given to his government, but he declined to specify what they are, saying Mauritanians would first rely on "Allah, the all-powerful." He did add that his government reserved the right to call on anyone for assistance "in case of need."

Mauritania's relations with Libya are more circumspect. Just last December Haidalla accused Libyan diplomats here of plotting with Mauritanian opposition figures to overthrow his government, and expelled three Libyan diplomats. Relations were patched up in January when the Libyan foreign minister visited here.

Libyan leader Muammar Qaddafi visited in mid-April, and proposed that Mauritania and the Western Sahara announce a merger of their governments. Haidalla quietly but firmly rejected Qaddafi's suggestion.

Yet because of strong bonds between the Mauritanians and Western Saharans, Haidalla's government "will have to be included in any future settlement" of the war, said a knowledgeable Western source, "and since it is a weak, vulnerable country, Mauritania is crucialf or its nuisance value because it is ripe for picking" by either Morocco, Algeria or Libya.

"Mauritania is the weak link in the Saharan chain," he concluded.