President Carter sent a special mission to Somalia yesterday in what now appears to be a new East-West contest for that nation's alignment after its defeat by Soviet-and Cuban-reinforced Ethiopian troops in the Ogaden region.

The Soviet Union at the same time is reported to have stiffened its attitude about using its influence to reduce Cuban troops in Ethiopia following Somalia's troop withdrawal from the Ogaden.

In addition, it was reported yesterday that Cuban troops in Ethiopia now have become involved in Ethiopia's other war, against secessionists in the northern province of Eritrea. There was no immediate confirmation here of this latest report in the whirl of developments in the Horn of Africa which affect overall U.S.-Soviet relations.

Cuban President Fidel Castro, in a speech in Havana Wednesday night, made no reference to any possible use of Cuban troops in the Eritrean conflict. But Castro said nothing about when the Cuban forces might be withdrawn after participating in "the great victory of the Ethiopian revolution on the eastern front."

Castro, referring to the Ogaden conflict, said, "The war is over." But he held out hope that in Somalia the "progressive, leftist" faction now may swing Somalia back to its previous alignment with the Soviet Union and Cuba. Somalia last November expelled thousands of Soviet military advisers and Cubans as it pursued its war against Ethiopia to "liberate" Somali ethnic people in the Ogaden.

It was Somalia's "rightist faction which imposed its aggressive and adventuresome line upon the Somali government," and "suffered a great defeat," said Castro, referring to the government of President Mohammed Siad Barre.

"What will happen in Somali?" Castro asked rhetorically, adding, "It cannot be predicted . . . Let us wait for the coming weeks to see what happens."

A senior State Department official told reporters last Friday that the Soviet Union had "indicated" that Cuban troops would be significantly reduced as Somalia pulled its troops out of the Ogaden. Some news accounts overstated the information conveyed to reporters, describing it as a Soviet assurance.

Next day, at a meeting between Secretary of State Cyrus R. Vance and Soviet Ambassador Anatolly F. Dobrynn, according to administration sources, Dobrynin backed away from the earlier expectations he had aroused about Cuban withdrawals. Dobrynin reportedly left the issue dangling in ambiguity.

State Department spokesman Hoding Carter said yesterday that the Cuban military presence in Ethiopia "is not less and is probably somewhat greater" than it was last week. At that time, U.S. officials said there were 12,000 Cubans in Ethiopia, and some more en route there, plus about 1,000 Soviet military advisers.

Yesterday, Vance and Dobrynin met at lunch, before Dobrynin's return to Moscow for consultations.

Officials said afterward only that Vance and Dobrynin "reviewed U.S.-Soviet relations." Those relations however, now are in an exceptionally fluid stage over a wide spread of issues ranging from the Horn of Africa, to nuclear arms control negotiations in Geneva, to human rights in the Soviet Union.

The dispatch of a diplomatic mission to Somalia is intended to explore, a spokesman said, "a whole range of U.S.-Somali arrangements," inlcuding the supply of American "defensive" military equipment. This mission is headed by Richard M. Moose, assistant secretary of state for African affairs.

President Carter has said that the United States hopes to improve its ties with Somalia, and also with Ethiopia, in the aftermath of their war in the Ogaden. The withdrawal of Somali troops from the Ogaden, a State Department spokesman reemphasized yesterday, should remove "the justification" that the Soviet Union and Cuba "claim for themselves" in sending Cuban troops, and Soviet advisers, to Ethiopia.

One of the many questions dangling over the Cuban military presence in Ethiopia has been whether, once there, they will be used in the prolonged "liberation war" for control of the province of Eritrea. Cuban military advisers previously have been reported in that conflict.

Cuban military units now have joined the Eritrean war, Reuter news agency reported yesterday from Nairobi, Kenya.

According to that report, diplomatic sources in Addis Ababa, the capital of Ethiopia, said that after participating in the Ethiopian victory over Somalia in the Ogaden, Cuban troops arrived in the Eritrean provincial capital of Asmara. The Cubans reportedly have been making probing attacks to test the strength of insurgent forces encircling the city. No figures were cited on numbers of Cubans.

Three weeks ago, Reuter said, the Eritrean People's Liberation Front announced that 2,000 Cubans had flown to Asmara from Angola, the original site of Cuban military involvement in Africa. Sources in Addis Ababa at that time said they considered the 2,000 figure too high.

American sources has no immediate comment yesterday on the reported presence of Cuban troops in Eritrea.