The Soviet Union is walking a tightrope between old and new allies in the Horn of Africa as both Somalia and Ethiopia press it with ever more vehemence to stop supplying arms to the other.

While Moscow appears determined to straddle the conflict in a bold bid to emerge as the dominant foreign power in both countries, this policy is becoming increasingly untenable as the war between the two neighboring nations - the worst ever between two black African countries - continues to grow.

Ethiopia now, like Somalia earlier, is resentful and suspicious of the Soviet policy of providing military assistance to its main enemy. This suspicion partly explains the sudden Ethiopian interest in restoring normal relations with the United States, the country that until last April was the main arms supplier of the Ethiopian armed forces.

The Ethiopian military government now blames the Soviet Union for the loss in late July of Gode, a small but strategic town with the only good airport in the disputed Ogden region. Ethiopians say they removed artillery and an armored battalion from there in April to fight rightist elements in northwestern Ethiopia on the advice of the Soviets, who reportedly assured Ethiopia that they would prevent the Somalis from attacking in force.

The Ethiopians had counted on the Soviet Union to prevent the kind of full-scale onslaught by Somali regular forces that has occurred in the Ogaden. Somalia apparently defied Soviet pressure and went ahead on July 23 with its long-planned strategy of conquering the region.

The growing Ethiopian irriation with Moscow was clearly visible a week ago at a press conference when Lt. Col. Mengistu Haile Mariam, the ruling Military Council's chairman accused the Soviet Union for the first time of "complicity" with the Somali "war of aggression" against Ethiopia.

According to the official transcript of the press conference, published Tuesday, Mengistu's reply to a question about Ethiopia's reaction to the Soviet policy of supplying arms and 1,500 military advisers to the Somali army was far stronger than the translation of his remarks during the press conference.

"It is difficult for me to accept the view that socialist countries are continuing to supply arms to this fascist government in Somalia which is now invading the oppressed masses of Ethiopia using its regular armed forces," Mengistu said, according to the official transcript.

"If the socialist countries are still supplying arms to Somalia," he continued, "then this is not only violating one's principles but also tantamount to complicity with the reactionary Mogadishu regime."

It was the one time during his two-hour press conference that the colonel showed signs of anger. He spoke in Amharic, the main local language, and his replies were translated into English by an interpreter.

Despite the impressive speed with which Moscow has responded to Ethiopia's arms request following Addis Ababa's break with the United States last April, the Ethiopian military government appears to remain uncertain whether it has full Soviet backing in the war with Somalia.

While Moscow apparently has slowed the flow of arms to Somaliar, once its closest ally in black Africa, client states of the Soviet Union like Syria and Iraq have begun sending supplies, possibly including tanks.

Western analysts here believe that the Soviet policy making establishment is divided between its political and military wings, with the former ready to line up solidly behind Ethiopia while the latter is reluctant to do so for fear of losing its naval and air-facilities along Somalia's Indian Ocean coast.

In principle, the Soviet Union is in agreement with Ethiopia on the need for respect of the territorial integrity of all nations and said as much in a joint statement after Col. Mengistu visited Msocow last May.

By contrast, however, a Soviet message of congratulations to Col. Mengistu on the military government's third anniversary made no mention of Soviet support for Ethiopia's national unity nor gave any other indication that Moscow was openly siding with Ethopia against Somalia.

In addition, Moscow did not send a particularly high ranking member of the party or government to the anniversary celebrations here.

This has led some Ethiopian efficials to conclude that the top Soviet policy makers are still waiting to see which side is most likely to win the war and deliberately keeping their options open.

At this point, Somali insurgents backed by the regular Somali army have occupied the entire disputed Oganden region, including all but two of the main cities that they claim as part of "greater Somalia."

Soviet arms are now pouring into Ethiopia and the war could still shift in Addis Ababa's favor. After delivering about 150 tanks and armored ars here this summer, the Soviet Union is now sending as many as 300 more and more than 40 Mig jet fighters, according to Western oilomatic sources here.

The new tanks and armored vehicles have already arrived at Ethiopia's Red Sea port Assab and the Migs are coming in by both sea and air transport directly to the capital. Whether they can make a difference in the fighting at this late date remains to be seen.

After building the Somali armed forces into the best equipped in black Africa, Moscow now appears ready to match its military investment in Somalia here in Ethiopia. If nothing else, this will make its new Ethiopianally almost as totally dependent on Soviet arms as is Somalia, giving the Soviets enormous leverage in the making of peace when the two neighboring countries have exhausted themselves in fighting.

Right now, neither side appears ready to do anything but continue the war. Contrary to all expectations, it has gone on for eight weeks, far longer than it was thought either side could sustain combat.

Just what the Soviets can or will do to force a compromise or end the war is very uncertain. There is a feeling among some Western diplomats here that whichever side loses will blame the Soviet Union and have a serious falling out with it.

In any case, it is doubthful that either Ethiopia or Somalia will care now to entrust its future solely to the dictates of Soviet policy, leaving Moscow in a difficult and uneasy position in the Horn of Africa, even if it manages to remain the dominant foreign power because of its arms supplies.