Faced with a disgruntled and humiliated army, scorned by his erstwhile Soviet allies while kept at an arms length by the United States, Somali President Mohammed Siad Barre flew off to China yesterday to look for help.

Since only four days ago he crushed a coup attempt by disgruntled soldiers, Siad Barre's departure for a distant destination was seen by political analysts as an effort to exude confidence and an act of diplomatic desparation.

The defeat of his army in the war with Ethiopia has shaken his hold on the military as well as wiped out most of his military equipment.

But China hs neither the economic muscle nor the war material to provide Siad Barre with the aid he needs to overcome the gravest challenge he faced since taking power in 1969.

Despite a myriad of problems, Siad Barre has managed to say in power for nine years, a record for this East-African nation. Moreover, he has decided to defy something of a tradition in African history which has been regularly marked by the overthrow of leaders while traveling abroad.

Yet, for all his efforts to exude confidence, the mood here is best exemplified by the nighttime roadblocks around Mogadishu. His regime may have crushed a coup on Sunday, but few in this newvous capital think it will be the last.

There were continuing reports, in fact, that the Mogadishu plotters were still active in other parts of Somalia.

Continued trouble in places as far away as the northern city of Hargeisa - and considerably closer to the capital as well - was interpreted less as an immediate threat to his regime than as symptomatic of forces gnawing away at his once unchallenged authority.

The reported execution on a nearby Indian Ocean beach of some three dozen key plotters - mostly officers in a tank battalion which spearheaded the abortive Mogadishu attack Sunday - has done little to change this analysis among many Somalis and foreign diplomats alike.

All of a sudden the 59-year-old leader is faced with economic, refugee and internal political problems which would defy many a richer and better buttressed regime.

Indeed less than 10 months after launching a long cherished irredentist war against Ethiopia to reunite ethnic Somalis on both sides of the border. Siad Barre looks like one of the world's least politically attractive credit risks.

His dilemma is straight out of a contemporary Third World primer's chapter on coups: how to remain in power after a disastrous war when faced by an angry and humiliated army shattered in combat and deprived of even a modicum of modern equipment.

The conventional wisdom among Somalis and foreign diplomats here is that only the United States can save the situation - preferably by allowing the transfer of American material from Third World reciepts to assuage the army.

But the United States has shown no haste in coming to Siad Barre's rescue for the more than a month since his troops withdrew from the Ogaden and a coup became less a matter of pure speculation than a question of when.

Observers have yet to detect any positive American move since March 23 when, after 12 hours of talks with Siad Barre, Richard Moose, U.S. assistant secretary of state for Africa, left here for home.

Siad Barre refused to accept U.S. conditions for economic aid and defensive arms: renunciation of the heartfelt Somali desire to reunite their ethnic brothers living under Kenyan, Ethiopian and even Djibouti rule.

The president's immediate problem was whether to crush his opposition or seek an accommodation.

The beach executions need not necessarily signal an all out crackdown although the coup attempt has given Siad Barre" a golden opportunity - just the pretext he was looking for," as one source said.

There is another popular theory which insists Siad Barre knew about the coup and let it happen knowing it was ill prepared.

Siad Barre himself in a speech Tuesday night marking the 18th anniversary of the founding of the Somali army, praised the loyal units for "having employed every effort to avoid blooshed and having in an intelligent way, captured most of them (ringleaders) except a few who fled and are being hunted down."

To veteran Somalia analysts, the president seemed to be making a distinction between punishing officers responsible for the attempted coup and sparing the enlisted men. His defense minister. Gen. Mohammed li Samantar, suggested that the coup troops had been misled by their leaders into thinking they were to put down a combined Russian-Ehtiopian seaborne invasion of Mogadishu.

But even if Siad Barre does opt for relative clemency, observers fear that he may have already compromised his most glorious achievement: overcoming the clan loyalties - and ancestral hatreds - which weakend the regime he overthrew.

In what one keen observer of Somali politics labelled "perhaps his most glaring error," the president reshuffled his government on April 1 and eliminated three old 1969 coup colleagues and two deputy defense ministers.

All were from northern or central Somalia and because of the carefully balanced regime he had wrought in the past their dismissal was seen as tantamount to blaming them for the reverses in the Ogaden - and them alone.

Ever since Siad Barre ordered the "withdrawal" of Somali forces from the Ogaden in early March his critics had charged that he was a southerner, specifically a member of the Darod Marehan tribe, and had abandoned his northern brothers who from the beginning were more intent on the war. Even after the disastrous defeat at Jijiga, northerners insisted the war continue.

His defenders claim the president "knows full well he's finished if he withdraws into his Marehan shell," but the Pretorian guard that saved the day Sunday was drawn almost entirely from his own tribe.