The United States has blocked the delivery of American arms to Somalia through its main Middle Eastern allies and as a result the small East African nation that has just broken its military ties with the Soviet Union is judged to be in a precarious position.

Both Iran and Saudi Arabia last summer sought permission from Washington to transfer U.S. arms in their own large arsenals to Somalia but were refused, according to Arab and American diplomatic sources.

The American response to its two most powerful friends in the region dramatically highlighted the extent to which Washington has gone to avoid any involvment, either direct or indirect, in the war now raging between Somalia and Ethiopia.

The main reason for this display of neutralism appears to be the Carter administration's desire to disassociate itself completely from Somalia's attempt to annex about one-third of Ethiopia.

One consequence of this "hands-off policy" is that Somalia President Mohammed Siad Barre now faces a critical three to four month period during which he could either be overthrown from within or overwhelmed from without by an Ethiopian counteroffensive now in the making, according to these diplomats.

"Somalia served the interest of the West but is getting nothing in return," on Arab diplomat said ibtterly of the dilemma now facing President Siad Barre.

Ironically, the United States has ended up opposing the efforts of twho of its most important Third World allies to bring an end to Marxist and Soviet influence in a country long regarded in policy-making circles as of strategic important because of its nearness to the Bab el Mandeb straits at the southern end of the Red Sea.

Early last summer, President Carter expressed a special interest in helping Somalia to extricate itself from its entanglement with the Soviets. At one point, he offered to provide Siad Barre with "defensive arms," but he quickly reversed himself - as did France and Britain - because of the ongoing war between Somalia and Ethiopia.

U.S. policymakers have been wary of getting involved in Somalia because of its historic claims to large tracts of Somali-inhabited territory in Ethiopia and Kenya. In effect, the Carter administration found that its African policy was in direct conflict with that of Saudi Arabia and Iran in the Horn of Africa, the bulge in north-eastern Africa where Somalia and Ethiopia are located.

So far, its concern for the effect American military aid to Somalia would have on its African policy apparently prevailed. There is widespread apprehension throughout the continent about any change in national boundaries by force of arms, as Somalia is attempted to do.

U.S. officials confirmed that Washington had opposed the transfer of American arms to Somalia through Iran and Saudi Arabia and justified the decision by saying the Carter administration had no congressional backing for such an action and that it might have endangered its military arms programs with these two key regional powers.

They also asserted that in ousting the Soviet Union the Somali government had acted first out of intense concern for its own national interest despite the risks. Somalia's armed forces are still entirely equipped with Soviet arms.

One American official hazarded that Somalia may have decided to make such an abrupt break in the hope of attracting Western support that it had failed sofar to obtain by following a more cautious policy toward the Soviets. Similar "shock treatment" was used by Egypt in 1972 when President Anwar Sadat ordered all Soviet advisers out.

He failed to obtain enough arms from the West to replace his Soviet ones, and this lesson was until recently very much in the minds of Somali policy makers.

U.S. officials seem fully award that Somalia is now at a critical juncture in its relations with both East and West and that President Siad Barre could fall if no Western military assistance us forthcoming.

Still, they affirm their faith in the Carter administration's decision to stay out of the Somali-Ethiopian conflict that has plunged the governments of both countries into crises.

The neighboring East African states have been locked in a full-scale war since mid-July over the vast Ogaden region that lies within Ethiopia but is regarded by Somalia as historically belonging to it. The war appears to have reached a stalemate with Somali insurgents backed by the Somali army unable to seize their last two key objectives - the towns of Harrar and Dire Dawa - and the Ethiopians still strugging to mount a successful counteroffensive.

One of the main reasons for the Somalia failure to take these last two objectives is that the Sovet Union, in a dramatic switch of alliances in the region, has rushed massive quantities of arms to Ethiopa to fill the gap created after the military government ther broke its military tiest to the United States last April.

Somali sources say President Siad Barre's decision to oust the Soviet Union was taken after it became clear that Moscow had opted entirely for Ethiopia in the conflict.

They said that the Soviets had also stopped providing spare parts to Somalia beginning in mid-summer. President Siad Barre's secret two-day trip to Moscow in early September, and his failure to sway the Soviet away from their pro-Ethiopian "tilt," was the turning point in the developing Somali-Soviet drama, according to these sources.

So far, it remains unclear to U.S. African specialists just how much support President Siad Barre has within his government for the decision to break diplomatic relations with Cuba, cancel the 1974 Somali-Soviet friendship treaty and oust all Soviet military advisers. Some of his civilian advisers are devout Marxists, and there are hundreds of Soviet-trained officers in the Somali armed forces.

Arab sources familiar with the internal Somali political situation said Siad Barre's failure to obtain Western aid now could seriously undermine his position and provoke a coup.

Saudi Arabia has long sought to obtain U.S. backing for its efforts to swing Somalia into the moderate Arab camp. Earlier this year, there were reports that the Saudis were offering to foot the entire expense to Somalia of switching from Soviet to Western arms.

But Washington was always extremely chary of the Saudi initiative because of Somalia's well known interest in taking possession of what it regards as its "lost lands" now part of Kenya, Ethiopia and the Republic of Djibouti.

Another important factor in the Carter administration's attitude toward the Horn of Africa conflict is its conviction that the Soviet Union has far overextended itself throughout Africa and that its position there is destined to collapse under its own weight.

"The Soviets are in a hellish dilemma in the Horn of Africa," remarked one U.S. official hardly disguising his pleasure.