Members of a leftist group stormed the French and Costa Rican embassies in here about noon today, taking the ambassadors of both countries hostage.

The group claming responsibility is the Popular Revolutionary Bloc, a coalition of trade union and peasant groups.

The attackers reportedly were demanding the release of five leaders of the group who were arrested or disappeared May 1.

At the French Embassy, on one of San Salvador's main thoroughfares, several shots reportedly were fired before the attackers secured the building. A guard reportedly was injured in the shooting. He and at least two secretaries are being held along with the ambassador, according to a source concerned with the embassy security.

Reuter news service reported that there were nearly 30 hostages in the two embassies, including French Ambassador Michel Dondenne and Costa Rican Ambassador Julio Esquivel Valverde.

The number of attackers also was not clear. UPI said there were about 30 at each embassy.

Little information could be confirmed about the situation at the Costa Rican Embassy, which is on a back street in one of the wealthiest sections of the city. According to one report, three attackers made the initial entrance into the building, but 20 others were repelled by the Salvadoran police and National Guardsmen on duty there.

Later this afternoon, however, two motorcycle police officers were shots to death with machine guns while driving through the city.

Attackers reached by phone in the French Embassy said their group had nothing to do with the deaths.

The El Salvador government claimed the security officers were killed by members of the Popular Revolutionary Bloc. I described the group as "heavily armed terrorists," according to a report from the Associated Press.

Both embassies, located in the western part of the city, were surrounded by police and national guard troops by late evening. The police, however, were keeping a low profile. One of the reported demands of the revolutionaries was that the police stay away from the embassies. Visitors were barred from the area.

One reporter approaching the Costa Rican Embassy was stopped at gunpoint, searched and then ordered away. A man who identified himself as a Costa Rican diplomat near the embassy said there were no injuries there.

The incident appeared to be the latest in a series of sit-ins at embassies, government offices and a United Nations office in San Salvador by opponents of the government led by Gen. Carlos Humberto Romero.

The sit-ins, which usually end peacefully, have occured against a back drop of continuing political violence by both leftist and rightist groups. During the past two years in El Salvador, the foreign minister was kidnaped and killed, six foregin businessmen were kidnaped, at least four priests were murdered and human rights groups have reported the murder or disappearance of hundreds of peasants and union members.

One of the invaders at the French Embassy told an Associated Press reporter by telephone that he could see the police outside, adding: "We want to say, if they are aggressive toward us, it will make the situation much more difficult."

Jean Duffaud, an embassy employe, also was reached by telephone and told AP the ambassador and five Salvadoran employes were being held hostage.

Asked if the invaders had weapons, he replied, "I can't say anything because they are listening to the conversation."

Duffaud said a telegram had been sent to the French government with the invaders' demands.One demand, he said, was for France to take the issue of political prisoners in El Salvador to the United Nations and the Organization of American States.

There was no comments from government or police officials.

Amnesty International and other human rights groups have accused the government of holding large numbers of political prisoners.

The Inter-American Human Rights Commission of the Organization of American States sent an investigating mission to El Salvador last year. Its report charged the government with "numerous deaths" as well as the use of "psychological and physical torture" in secret dungeons and repression against the church and political opponents.

The United States suspended aid to the previous government of Gen. Arturo Molina because of rights violations, but new aid has been granted since Romero was elected in 1977.

Yesterday's attack recalled a raid on Aug. 22 on the main government building in the capital of neighboring Nicaragua. In that raid, Sandinista guerrillas opposing the government of President Anastasio Somoza held 1,500 ransom, freed 58 political prisoners and allowed the guerrillas and released prisoners to fly to Panama. The raid was followed by serious fighting in several parts of Nicaragua that threatened to topple Somoza.

Diplomatic and other observers have long considered the situation in El Salvador potentially as explosive as that in Nicaragua.

El Salvador, which is the size of Massachusetts with a population of 5 million, is the most densely populated country of Latin America. Most of the wealth is concentrated in the hands of a few families, and social and economic tensions have been rising for some time.

A report by the Washington Office on Latin America, a church-funded human rights group, said that the percentage of rural families with no land has risen from 12 percent in 1961 to 41 percent in 1975. For this reason thousands of Salvadorans have migrated to neighboring countries and the United States, including a large number of both legal and illegal immigrants in the Washington metropolitan area.

At least two leftist guerrilla groups are active in the country as well as a number of rightist organizations accused of torturing and killing peasants and priests they consider Communist Sympathizers.

One of the leftist groups, the Armed Forces of National Resistance, has kidnaped six businessmen. One Japanese businessman and a Salvadoran were killed, three foregin businessmen were released for ransom and two British bankers are still being held. CAPTION: Map, no caption, By Richard Furno-The Washington Post