A powerful bomb apparently set off by right-wing terrorists today damaged a cathedral in which the bodies of six assassinated leftist opposition leaders were living in state, sending their caskets flying through the church and seriously injuring at least five persons.

The explosion coincided with gun battles in slum areas of San Salvador between Army troops and leftists who have accused the government of complicity in the assassinations.

Responsibility for the blast was claimed by the same rightist group that last night said it had carried out the killings. The explosion wrecked the front of San Salvador's Metropolitan Cathedral and badly mutilated the body of one of the dead leftist leaders, according to witnesses.

The bomb, which was planted in a car parked in front of the cathedral, also set fire to the church and several nearby shops. The bodies of the leftists were being guarded by about 50 supporters when the blast occurred.

The slaying yesterday of six of El Salvador's most prominent revolutionary political leaders was the first glaring sign of a major rightist shift in the balance of power in the embattled U.S.-backed government and in the country.

Among those killed was Enrique Alvarez, a businessman and former government minister who was president of the left-wing Democratic Revolutionary Front. His body was discovered this morning. The prominent opposition figures were killed following their abduction by gunmen during a meeting here yesterday morning.

Also slain were Humberto Mendoza of the Popular Liberation Movement, Enrique Barrera of the social democratic National Revolutionary Movement, Juan Chacon, secretary general of the Popular Revolutionary Bloc, and Manuel Franco of the communist National Democratic Union. Their bodies were identified after being taken to a local funeral home. All five had belonged to the six-member front directorate. Later, another opposition figure, Doroteo Hernandez was reported killed.

The front, a coalition of center-left and leftist political organizations allied with guerrilla movements here, has accused government security forces of mounting the attack. But the ruling junta has denied any complicity.

However, the abductions and killings are viewed here as conclusive proof of the sharp turn to the right that began when conservatives inside and outside the government increasingly took the initiative during the last few weeks.

Whether the people will follow them and whether the left ultimately will be strengthened or weakened by the actions of its opponents remains to be seen. But interviews with politicians, diplomats and military men this week suggest that what happens in the next several weeks will determine El Salvador's forseeable future.

Even before the killings, several crucial elements had suddenly come together on the calendar. This is the harvest season, when El Salvador's crippled economy will either earn enough foreign exchange to survive or find itself desperately close to bankruptcy and when attempts to institute sweeping land reforms either will show signs of success or fail and, perhaps, be rolled back.

This is the dry season, when major military operations can take place unimpeded by the weather, and government troops have their best change of wiping out guerrillas in their strongholds.

More important, it is a time when Uncle Sam may blink as the administration of the United States passes from this government's patrons into the hands of Republicans with an as yet undeveloped policy toward the area. There are high hopes among conservatives in El Salvador that what has been an arena for the Carter administration's experiments with liberalization and human rights will become the focus of a Reagan administration's experiments with a hard-line stand against communism.

It is also a time when the opposing forces here, after more than a year of virtual warfare, are sizing each other up like exhausted boxers in the 15th round of a championship, looking desperately to land a knockout punch but unsure whether they have the strength to do it or to defend themselves if they fail.

In this context both the left and the right here have stepped up their efforts to destabilize the country, and the pressure has been felt strongly within a government that has always represented an uncomfortable coalition of interests and ambitions.

The government, installed and backed by the Salvadoran Army with the blessing of the United States in October 1979, is headed by a five-man junta including two military men, two Christian Democratic politicans and an independent. The current group of civilians is the third. One by one, their predecessors, including the present leadership of the front and former juntas such as Alvarez, have dropped out, charging the military with breaking its promises to end repression and to work to install a representative democratic system.

Less a referee between the right and left than a third fighter in the ring, the government has mixed U.S.-promoted liberal economic and social policy with massive, often brutal military tactics supported by its own right-wing component and that of the private business sector in an attempt to wipe out the threat of several thousand increasingly well-armed leftist guerrillas.

Its reaction to the killings yesterday reflects something of this. The government categorically denied any participation in the abduction or execution of the five Democratic Revolutionary Front leaders, who were considered the left's best hope for a negotiated political settlement of the undeclared war between the military and rightist paramilitary groups and the front-allied guerrillas.

The government has accused the right of carrying out the killings, while deriding the left for trying to profit from the death of its leaders. The left, meanwhile, is continuing to blame the government for the incident.

Last night, the Maximiliano Hernandez, Brigade, a recently formed, underground right-wing organization, claimed responsibility in clandestine statements for the killings. Leftists assert that the brigade has connections with rightists among the Salvadoran military.

What may turn out to be even more significant than the attempted decimation of the political left, however, is the reported departure from the country yesterday of Col. Adolfo Arnoldo Majano, one of the junta's two military members.

The government initially made no comment about his absence from the country, which was confirmed early today by usually reliable sources. Although a soldier, Majano is widely regarded as the most liberal member of the junta and is publicly at odds with the rest of the government and its security apparatus. One of the prime movers behind the Oct. 15 coup that ousted the corrupt government of Gen. Carlos Humberto Romero, Majano has since steadily lost control and command within the shaky civilian-military coalition.

Earlier this month, he was nearly assassinated when a powerful bomb was detonated within what was presumed to be a closely guarded compound. Majano has reportedly held several secret meetings with the political leadership of the left, which is distinct from and markedly more moderate than, its guerrilla allies. For 2 1/2 months after the October coup, many of the left's leaders, and apparent centrists like Alvarez, who served as agriculture minister, were brought into the government.

But since a confrontation between leftists and the military brought the fall of that first coalition early this year, the left has refused to accept any open negotiations. When the Roman Catholic Church here recently offered to mediate between the government and the opposition, the government accepted, but the revolutionaries flatly refused.

Meanwhile, the guerrillas mounted a concerted offensive to destroy the economic foundations of the country, attacking and intimidating farmers involved in the harvest and bombing coffee storehouses. Government forces set out at the same time to exterminate the guerrillas in their own camps, inflicting heavy civilian losses in the process.

Last month the military mounted a major campaign in the Morazan district, which the guerrillas had hoped to establish as a "liberated" zone.

"We came, we circled, we destroyed, we eliminated," said Minister of Defense Jose Guillermo Garcia. "Practically speaking it is liberated now, but completely on the government side."

Late today, a presidential press-spokesman confirmed Majano's departure from the country. He said Majano was on a "brief, private trip of a personal character," and added that he would be back at work next week. Diplomats inquiring after him today were told he would return in "a couple of days" but not where be had gone or why.