Militants of the Popular Revolutionary Bloc ended their four-week occupation of the French Embassy in El Salvador yesterday and released six hostages, including French Ambassador Michel Dondenne.

Hundreds gathered in front of the embassy at midmorning to sing and cheer as the 16 smiling militants boarded a bus en route to the San Salvador airport. A French Air Force plane took them to Panama - which offered them "political asylum, in transit." Their ultimate destination may be Mexico.

The departing militants' bus also passed by the Embassy of Venezuela to pick up another nine members who had occupied it since May 11. Hostages who had been held there escaped nearly two weeks ago.

Police and troops who had surrounded the embassies withdrew as the militants and crowd cheered, "Forward, forward . . . the fight will continue." Those at the French Embassy, which had been occupied since May 4, wore red and yellow masks, the colors of the Revolutionary Bloc, a peasant-student coalition.

On Thursday, the Revolutionary Bloc accepted a longstanding Panamanian asylum offer, and the Panamanian government reportedly flew its own Air Force plane to El Salvador to pick them up.

Snags in the plan developed when the militants apparently changed their minds and renewed earlier demands that they be given liberty in their own country, something the government had strongly rejected.

Thursday night, the Panamanian Foreign Ministry angrily withdrew its asylum offer, noting a statement that the Bloc "members occupying the embassies of France and Venezuela will not be accepted into asylum in our country." The Panamanian plane went home.

Later that night, sources said, exasperated French Foreign Ministry officials in Paris phoned to ask Mexico to accept the militants. The Mexicans agreed.

The French, meanwhile, dispatched their own Air Force DC8 to El Salvador from a base on the Caribbean island of Guadeloupe.

"After the problems we had with Panama," said Philippe Cuvillier, the French Foreign Ministry's director of American affairs who handled his government's negotiations with the militants, "we thought it was a good idea to have our own plane."

It took off early in the afternoon with two French diplomats on board to guarantee the Bloc Members' safety until landing.

Ambassador Dondenne, 62, later emerged looking pale but happy, and told the crowd, "It feels good to be free again."

El Salvador's military-based government last week declared a state of siege following the May 23 assassination of Education Minister Carlos Antonio Herrera-Rebollo left-wing guerrillas.

In the continuing circle of violence that has torn this country for the past month, Herrera-Robello was killed in retaliation for the government's shooting of 14 youths who had attempted to carry food to the militants inside the Venezuelan Embassy the day before.

The violence began May 4, when the Revolutionary Bloc occupied the French and Costa Rican embassies and took hostages to exchange for Bloc members they said had been arrested by the government. The government denied the arrests. CAPTION: Picture 1, Captivity ends for Ambassador Dondenne, left, and Jean Duffaud, a counselor. UPI; Picture 2, Militants from the Popular Revolutionary Bloc leave the French Embassy.AP