Huge crowds of Cubans today jeered as they marched and danced past the Peruvian Embassy, where more than 10,000 of their fellow citizens have taken refuge in hopes of leaving the country.

Witnesses said at least several hundred thousand people participated in the day-long march. The government estimated the crowd at a million -- half of Havana's population. Some participants came by bus from outlying areas.

The Cuban government, deeply embarrassed by the number of refugees who stormed the embassy on April 5 and 6 when official guards were briefly removed, organized the parade to demonstrate that President Fidel Castro and socialism still have broad support here.

Approximately 800 of the embassy refugees have flown to Costa Rica, where most will leave for other countries.

[Meanwhile, Costa Rica anounced it has recalled its top diplomat from Havana in an official protest of his beating while accompanying refugees to the airport, news services reported from San Jose.]

Yesterday, Castro stunned diplomats here with his sudden decision to halt the airlift. According to the Communist Party newspaper Granma, countries that want to receive the Cubans should send their own planes to transport them.

Castro's decision particularly inconveniences the United States, which plans to accept 3,500 of the refugees but hoped to send them first to Costa Rica until they could receive U.S. security clearances.

Officials at the U.S. diplomatic interests section here said they did not know what the next step would be.

"We don't know if this is permanent," one U.S. official said of the airlift halt. "But this situation is impractical and untenable."

Cuban sources said, however, that landing permits would come "in the next few days" for a fleet of small boats assembled by Cuban exiles in Miami who want to pick up their compatriots. Despite the government's pressing of its views, the crowd's enthusiasm seemed genuine.

For Castro, the demonstration of patriotic fervor was a clear success. The government in this tightly run society has always shown it can mobilize the masses when needed. This week the press, the party and the neighborhood committees constantly exhorted people to join the march against "the rabble and the parasites."

For more than 12 hours the demonstrators thronged down the broad Fifth Avenue where the Peruvian Embassy is. Aside from the usual anti-American slogans, their banners insulted Peru and the refugees, calling them "scum and delinquents." Homemade paintings showed refugees disappearing into garbage cans and toilets. Other signs read, "We are poor but dignified."

Angry as many people seemed near the embassy, the atmosphere was more than that of a Latin carnival, promoted by the music on the public address system and the drums the marchers carried.

The fervor of the crowd grew noticeably as it passed by the television cameras of the foreign and domestic press.

The foreign press, with very few exceptions, had been refused entry into Cuba to cover the refugee problem. But yesterday most reporters were suddenly given ample visas in time for the march. Reporters and their cameras were carefully herded into a corral two blocks away from the Peruvian Embassy and none was allowed to visit the embassy today.

No incidents were reported near the embassy, which was guarded by two battalions of militia to "avoid any violence that may come from justified indignation," as the public address system announced.

But in previous days crowds have attacked refugees under police escort as they were leaving for the airport. Last night a virtual riot broke out as angry crowds heckled refugees leaving the compound with a police escort to get sale-conduct papers and passports.

The crowd pushed aside police escorting a couple and started mobbing them until more police arrived. A policeman on the scene said that earlier one refugee who spat in the face of a heckler was attacked by the crowd and had to be taken to a hospital.

Aside from showing support for Castro's revolution, sources said today's march was designed also to put pressure on the refugees who refused to use their safe-conduct passes to go home to await departure.

"We think we'll find the embassy empty on Saturday," said one government source here. "People inside won't be able to stand the pressure of a million people shouting outside."

Peruvian diplomats told reporters today that 1,500 people are left in the embassy. This would imply that more than 7,000 people have left in recent days to wait elsewhere.

The Peruvian diplomats told colleagues that while the situation was no longer as critical, the scene was still dramatic.

"My colleagues said that the stench and mud are unbearable," said one Western diplomat. "As panic and tempers run high there have been dreadful incidents. Last week people, including babies, were trampled on and badly wounded. There have been some cases of rape."

The government's relations with Peruvian and Venezuelan diplomats have been severely strained in the last few months as both embassies began admitting Cubans asking for asylum.

An official Cuban bulletin says that while the refugees were discontent about economic or political conditions, "in none of these cases were the elements who entered the embassies through the use of force involved in political problems and therefore had no need for diplomatic asylum."

The Venezuelan Embassy has 15 Cuban refugees. When a group of 25 Cubans rammed through the Peruvian Embassy gates with a bus earlier this year, Cuban guards opened fire and a guard was killed by a ricocheting bullet. yThe Peruvian government then refused Cuba's request to hand over the refugees to face criminal charges.

As Cuba then removed the traditional armed guard from the embassy, announcing the fact in the press, thousands of people saw this as their chance to flee the island and stormed the embassy.

"The Cubans knew this would set off a stream of refugees, but they admit they underestimated it," said one foreigner who recently spoke to Castro. "Now they are getting rid of a lot of discontents, which they're happy about, but they also got themselves a huge image problem."

Peru reportedly decided to break ties with Cuba but Mexico refused its request to take charge of Peruvian affairs here, postponing the move.

Meanwhile, the Intergovernmental Committee for European Migration, which has sponsored the refugees' flights, requested funds to continue the operations.