U.S. Ambassador John Loughran returned today from lengthy consultations in Washington as the last of the expelled Soviet military advisers boarded five Soviet airliners for home.

The contrasting scenes at sweltering Mogadishu airport symbolized Somalia public satisfaction with the departure of the Soviets - once estimated by Western diplomats to number about 7,000 - and the great expectations placed on the United States.

Soviet sources said that their total presence here would be less than 30 - including a 13-officer embassy staff and three employees of the Soviet Aeroflot airline. Among those leaving before President Mohamed Siad Barre's week-old evacuation deadline expired at midnight was the correspondent of the Soviet news agency, Tass.

Diplomatic sources said the Soviets have towed away the massive drydock from the north-coast naval base at Berbera and dismantled or destroyed telecommunications equipment and removed missiles stocked there Indian Ocean fleet.

The equipment was headed for Aden, the deep-water port of the still friendly South Yemen Republic just across the Gulf of Aden from Berbera.

The evacuation ended the once massive Soviet presence, sacrificed this year when Moscow began supplying arms to Ethiopia, a traditional, but recently estranged American zone of influence. Somali forces are fighting Ethiopian troops for control of Ethiopin's Ogaden region.

The exact number of Soviets to have left Mogadishu by air this week is estimated at more than 1,600. Other personnel presumably were evacuated in the south from the port of Kismayu and in the north from Hargeisha, an inland center, and Berbera.

A Soviet military transport and a civilian cargo ship left Mogadishu harbor today with an undisclosed number of passengers plus equipment.

Indicative of the public mood was fleeting speculation yesterday that the transport ship entering the harbor was an American vessel bringing much-sought arms for Somalia.

The rumor took form when a crowd on a Mogadishu beach momentarily mistook numerals painted on the Soviet ship's bow for those used by the U.S. Navy.

The incident indicates the delicacy of Ambassador Loughran's mission to explain the continuing American refusal to provide arms to the Somalis.

Although the Mogadishu government is aware of the recently reiterated U.S. decision, and of reports that Washington forbade its Saudi Arabian and Iranian allies from providing arms from their arsenals. Nevertheless, the public appears to be convinced that the United States will reward Somalia for ousting the Soviets.

Aside from rigorous customs checks - and occasional minor incidents such as stones thrown at Soviet vehicles - the evacuation went smoothly.

By the final day, the most avid onlookers at the airport were not the Somalis, but Chinese diplomats visibly relishing their Marxist ideological foes' discomfiture.

[In Peking, the New China News Agency carried a dispatch from Mogadishu saying that a Chinese government delegation visiting Somalia told the president, "We appreciate and support. The "firm and resolute act" of cancelling the friendship treaty with the Soviets.]