Tens of thousands of festive Somalia clapped and sang and shouted their determination yesterday at a mass rally to support the government's call for national mobiliation and the decision to take part openly in the fighting in Ethiopia's Ogaden region.

Yet, experienced foreign analysts suggested that the real purpose of the defiantly worded declaration issued late Saturday may have been to signal that Somalia is looking for a way out of an increasingly difficult situation in its struggle with Ethiopian forces backed by the Soviet Union and Cuba.

As the people of Mogadishu gathered to show support for President Mohammed Siad Barre, Somalis said they had massed in such numbers only once before - when Said Barre expelled his Soviet military advisers last year.

Students, Boy Scouts, workers, housewives, old-timers with makeshift wooden swords and spears assembled on a grassy slope beneath a monument to a Somali poet-patriot. They sang songs of Somali national dreams and waved placards saying "We are ready to defend the motherland" and - in English - "Down with the USSR". The S's were shaped like swastikas.

Siad Barre spoke in tones more fatherly than fiery as he explained the decision of the Somali Revolutionary Socialist Party to proclaim a national emergency and drop the fiction that Somalia is only backing indigenous guerrillas in the Ogaden, but not taking part directly.

He denounced the Soviet Union and Cuba for their involvement in the war and criticized the United States for its refusal to help Somalia, but pledged that this country would continue the fight relying on its own resources.

He did not seem to be in the despairing mood depicted by visitors who have seen him in the past few days.

Aside from the rally, which was oorganized by the government, there was hardly any visible evidence of the mass mobilization or the state of emergency announced Saturday night.

Life in the capital appeared normal. The government called for volunteers to report to the Ministry of Defense to join the conflict, but there was no line at the gates of the ministry.

According to experienced observers here, there are several reasons for the absence of any crisis atmosphere in what appears to be a critical moment for Somalia. One is that the government is only beginning to explain to the population just how grave the situation is and what may be expected of them.

Another is that the youth of Somalia, while they would no doubt fight if this country were actually invaded by Ethiopia, may be less enthusiastic about entering an unequal struggle on behalf of the Ogaden nomads.

Another is that in a technical sense there is nothing really new in popular mobilization here. The Somali government has been organizaing the youth, training university students and indoctrinating the populace for years. The difference is that this time the stated purpose is not ideology or economics but the defense of the nation.

Some diplomatic analysts said that they thought the announcement of the state of emergency and the mobilization were as much for external purposes as internal. Behind the effort to portray Somalia's as a brave but overmatched little country standing up to a ruthless superpower, they saw the formal entry into the war as a signal that Somalia wants a negotiated settlement before its troops are driven out of the Ogaden altogether.

Almost lost in the proclamation of the emergency was a Somali proposal for a "long lasting peace" in the Horn of Africa based on three points.

Point one was a cease-fire.

Point two was "the withdrawal of foreign troops from the region." While this clearly refers to the Russians and Cubans on the side of Ethiopia, it is also clear that by finally admitting it has its own regular army in the Ogaden, Somalia had put itself in the position of being able to offer to withdraw as part of a negotiated settlement.

Point three, which in the opinion of diplomats represents a considerable softening of Somalia's previous positions, is a "clear solution" of the problem of the Somali-speaking people of the Ogaden, based on their desire for "self-determination." This stops short of asking independence for the Ogaden people or their merger into Somalia, which was probably this country's original goal in entering the conflict.

If the Somalis were to announce the withdrawal of their regular forces while the Soviet Union and Cuba continued to take part in the war, Somalia might be in a position to renew its request to the United States and Western Europe for arms assistance, to aid the Western Somali guerrillas and to defend this country against what is perceived as a direct Soviet threat. Siad Barre said at yesterday's rally, however, that he had no hope of such aid.

A more likely move, observers here said, is an approach to the U.N. Security Council for a resolution seeking withdrawal of foreign force. If the Somalis complied and the Soviets and Cubans did not, it could again change the picture in Somalia's favor.