The Reagan administration, fearing the possible collapse of its one major diplomatic triumph in Africa -- the detente it has helped construct among itself, Mozambique and South Africa -- is groping for ways to shore up this country's frail socialist government.

The State Department's number two Africa envoy, Deputy Assistant Secretary of State for African Affairs Frank Wisner, left here yesterday for South Africa after a four-day visit during which he discussed with Mozambican officials how the United States can aid Mozambique further.

His trip follows last week's announcement in Washington that the administration is planning to seek authorization to spend more than $1.1 million in "limited military assistance" to the government of President Samora Machel.

Coupled with a previous U.S. agreement to launch an $8 million economic aid program and its commitment of 110,000 tons of emergency food shipments this year, U.S. diplomats say, the modest military aid is designed to demonstrate U.S. support for Machel. Other sources say that there is strong opposition inside the Mozambican armed forces to Machel's detente policy and that a U.S. relationship with the military, however small, is needed to counteract that opposition.

In Cape Town, Wisner said the United States would encourage attempts by South Africa to arrange a cease-fire between Mozambican rebels and the government, Agence France-Presse reported, quoting the South African Press Association.

If Reagan administration support for a self-declared Marxist-Leninist ruler of a one-party state appears incongruous, it is no less so than the response here. President Reagan's reelection victory was applauded warmly here, and praise of U.S. aid programs has largely replaced the diatribes against western imperialism that once were featured in the state-controlled daily press.

"We've come a very long way in a very short period of time," said U.S. Ambassador Peter J. De Vos in an interview. "If relations are not perfect, they are very, very good and are getting better."

Besieged by drought and an armed insurgency that in the past was supported by neighboring, white-ruled South Africa, Mozambique began to turn to Washington and other western capitals three years ago for economic assistance, capital investment and diplomatic leverage. It used its new relationship with the West to help broker a pact with Pretoria last March that was designed to put a stop to support for the rebels.

But insurgents of the Mozambique National Resistance movement remain strong, and officials here say they still are receiving arms and supplies from elements in neighboring countries.

"We shouldn't underestimate the tremendous sense of frustration the Mozambicans are feeling," said Rep. Howard Wolpe (D-Mich.), chairman of the House subcommittee on Africa, after he met with officials here two weeks ago. "They've done everything we've asked them to and more, and they do not have anything to show for that effort."

Mozambican officials reportedly would like the Americans to increase their aid to demonstrate growing ties or make an overt show of military support by providing sophisticated surveillance equipment.

The Soviet Union, once Mozambique's chief patron, has watched recent developments here with little public comment. Still, Mozambique gets more aid annually from the Soviet Union than from the United States, according to knowledgeable observers.

"They haven't really turned away from the Soviet Union as much as they have simply sought to broaden their international support," a western diplomat said. "The Soviet Bloc no longer holds a monopoly here, but that doesn't mean they don't have a lot of influence."