Somali President Mohammed Siad Barre lashed out at his former Soviet allies today in a speech suggesting that he is anxious to turn to the West for diplomatic and military aid.

His clear indication that Soviet Somali relations may be close to the breaking point came only four days after his leftist government played a crucial role in helping West Germany save the lives of 86 hostages held by leftist terrorists aboard a hijacked palne here.

Under Siad Barre, Somalia has been intimately associated with Moscow and was a model for Soviet relations with African countries.

Since the outbreak of armed conflict between Somalia and Ethiopia over the Ogaden region this summer, the Soviets have changed their policy toward the Horn of Africa, halting all military assistance to Somalia and giving armed support to Ethiopia instead.

Speaking at the celebrations marking the eighth anniversary of the military coup that brought him to power, Siad Barre denounced "the Soviet Union, Cuba and some other socialist countries" for supporting Ethiopia's "intrigues." He said that Cuban soldiers were fighting alongside the Ethiopians in Ogaden.

"The continuation of the present all-out armed support to the Ethiopian regime by the Soviet Union and the influx of Cuban troops put the relations between these two countries and Somalia in great jeopardy," he said.

By contrast, Siad Barre failed to make any reference to "Western imperialism" and other stock pejoratives that until a few months ago were a virtually obligatory component of all Somali political speeches.

"Somalia's range of friends all over the world has grown considerably," Siad Barre said without mentioning the West.

Yet, recent Somali actions, especially the decision to assist the West Germans in the commando raid of the hijacked Lufthansa airlines on Monday, reflect Siad Barre's assessment that he stands to gain more from the West than he will lose from radical Arab regimes, most of which back Ethiopia in the Ogaden conflict anyway.

Following the cutoff of Soviet military assistance, Somalia's urgent need for arms has become obvious in the Ogaden conflict.

After initial sweeping successes, the Somali assault across the barren desert has come to a standstill at the perimeter of the heavily fortified walled city of Harrar.

Almost all of the heavy equipment displayed at today's military parade was Soviet made. It included Mig jets, T-34 tanks of World War 11 vintage, 141-mm Katusha rocket launchers, 82-mm mortars, anti-aircraft and field guns.

According to Western diplomatic sources, the Somalis have recently received small arms from Islamis countries, mainly from Iraq, Syria, Saudi Arabia and Iran. But Somalia needs tanks and heavy artillery to capture Harrar and Dire Dawa, the key Ethiopian strongholds that have prevented Siad Barre from completing the Ogaden conquest.

Surprisingly, the Somali leader in his speech today did not deny that Somalia was directly involved in the Ogaden war. While non-involvement is still the official governemnt line, Siad Barre asserted that the people of Somalia and Western Somalia - the name now given to the Ogaden - constitute the same nation. He said the war was "essentially" between the West Somalia Liberation Front and "the Addis Ababa regime."

The Soviet arms cutoff has posed great problems for the Somali armed forces and evidently had played a key role in Siad Barre's decision to permit the West German military action against the officially unidentified terrorists who hijacked the Lufthansa aircraft.

Three months ago, The United States and Britain announced their willingness to sell arms to Somalia, but the two countries have more or less reneged and the Somalis are currently relying on their Arab friends with tockpiles of Soviet equipment to keep the Somali armed forces going.

It could not be determined with certainty that the West Germans have made any specific commitments to Siad Barre. He spoke for an hour by telephone to West German Chancellor Helmut Schmidt on Monday morning and later the same day confered for several hours with bonn's minster for state, Juergen Wischnewski after he flew to Mogadishu to deal with the hijacking ordeal.

Western diplomats here said that the Somali leader had clearly indicated that he wanted closer relations with the West, especially with the United States. Schmidt, in thanking Somalia publicly for its cooperation said "We won't forget it."

"An action like this will obviously lead to closer friendship," one Western diplomat here commented. An Arab diplomat here said that "the real test of Siad's wisdom will be if his humanitarian act has impressed the West enough to bring him the heavy weapons he needs to seize control of Harrar and Dire Dawa."

During the harrowing five-day hijacking ordeal, the West Germans asked two other Arab countries in which the plane had landed - Dubia and South Yemen - to permit a commando raid against the terrorists.

According to Arab diplomats, South Yemen refused while Dudai permitted the commando squad to land but demanded that Dubai armed forces join in the rescue operation.

Before Dubai soldiers could be properly instructed by the West Germans, the hijacked Boeing 737 took off for South Yemen.