Mogadishu's whitewashed stucco walls are still adorned with anti-Soviet and anti-Cuban slogans, but there is speculation here that the Somalis, in the aftermath of their defeat in the Ogaden war, are again flirting with possible return to the Soviet fold.

Such speculation is fueled in part by Somalia's desire to pressure the West into providing quick military asassistance to the battered Somali army. Yet, there is a real possibility that Somalia, driven by military defeat, economic desperation and internal political forces, may attempt to seek rapprochment with Moscow.

As a result, the mission here of Richard Moose, U.S. assistant secretary of state for African affairs, comes at a crucial time. Moose is to hold talks with President Mohammed Siad Barre and other Somali officials.

[Moose arrived in Mogadishu Saturday night, news services reported.]

Arab diplomats view the outcome of these talks as a crucial test of American intentions not only in Somalia but also in the rest of Africa.

In this view, if the United States does not provide economic and military aid to Siad Barre, it will force him either to step down or turn the country back into Moscow's orbit, thereby bringing new dangers to the pro-Western states in the region.

Restoration of Soviet influence in Somalia would give Moscow a chain of allies in strategic positions all around the Red Sea, with Ethiopia and Somalia on the African side and South Yemen on the Arab side. It would cause deep anxiety in Sudan and Egypt as well as Saudi Arabia and Iran, all of which fear the spread of Soviet power in the Horn of Africa. They all sought to help Siad Barre after he broke with the Soviets.

There have been indications here that Siad Barre may be preparing the Somalis for a rapprochment with the Soviets.

An obscure item that appeared in the bulletin of the Somali guerrillas the other day caught the attention of diplomats and journalists trying to figure out what Somalia will do in the aftermath of its defeat.

It said than an ethnic Somali woman and her children were being tortured by Ethiopian troops who had retaken their village in the Ogaden fom the fleeing Somali army, but they were saved by the intervention of two Soviet soldiers.

Those were the first kind words about any Russians heard in public here since Siad Barre expelled nearly 1,700 Soviet military advisers last November because Moscow was supporting Ethiopia in the war.

Some diplomatic observers here believe Siad Barre has no choice but to swallow his pride and revive his formerly close ties to Moscow, which until last year were the keystone of his power.

The process may already have begun. Just at the time the Somalis were being crushed by Soviet-eqipped Ethiopian forces in the battle of Jigjiga nearly two weeks ago, Siad Barre paid a surprise visit to pro-Soviet Libya.

Libyan Premier Abdel Salem Jalloud had just returned from Moscow and believed to have conveyed to Siad Barre stiff but not humiliating terms for rebuilding Soviet ties.

There are elements in Somalia, that probably would welcome a return to the Soviet orbit. But much popular sentiment would be against it, on the basis that the Soviets and their Cuban allies killed Somali troops at Jigjiga.

In the words of a middle-level government officials, "We would rather stay isolated and helpless than bring back the Russians. That would be suicide."

But he added that, "We have learned about the United States, too," a reflection of Somali bitterness toward the Americans, who they believe promise arms and aid if Somalia split with Moscow and then left them in the lurch when the arms were needed.

It is said that many ordinary Somalis feel the United States supported Ethiopia because the Ethiopians are Christians while the Somalis are Moslems - a view that may seem ludicrous to Westerners but nonetheless contributes to anti-American feelings. If Siad Barre could exploit that sentiment, and if the Soviets induced the Ethiopiansto offer some face-saving formula for local autonomy for the ethnic Somali in the Ogaden - no mean feat - a restoration of Somali - Soviet ties might be made palatable, observers here believe.

Siad Barre has given little indication of what he is up to, though diplomats here say he has met at least twice with the Soviet ambassador since the Jigjiga battle.

With his army shattered, thousands of refugees streaming across the border needing food and shelter, the economy stumbling, and technical assistance dwindling, he is thought to have an urgent need for outside help to keep the country afloat and to keep himself in power.

It would not surprise observers here if Siad Barre, a master manipulator and survivor, were to try once again to play the superpowers off against each other in search of the best deal for himself.

One of the first to find out may be Moose, who is likely to find the Somalis confused and angry over Carter's statements at his March 9 press conference. The president said that in addition to withdrawing from the Ogaden, Somalia would have to renounce its historic claims on Somali-inhabited areas of Ethiopia and Kenya before the Unitd States would even consider economic aid, let alone military. The Somali constitution specifies those territorial claims.

Carter's statement "raised the ante," as one observer put it, just when the Somalis thought that by bowing to the inevitable in the Ogaden they had satisfied previously stated U.S. conditions for assistance. The American Embassy, caught flat-footed, was unable to deliver the "clarification" sought by the Somali government.

Siad Barre is reported by well-placed sources to have little hope of direct American assistance. What he wants, these sources say, is for the United States to use its influence with Saudi Arabia, Iran, Egypt and Western Europe to encourage for provision, not just of arms, but economic aid.

If th price of obtaining that help, however, is a formal renunciation of Somalia's ancient dream of reuniting all Somalis under one national banner, Siad Barre may not be willing to pay it.