The most famous and influential leader of this country's leftist guerrillas, Salvador Cayetano Carpio, committed suicide last week after learning that his second-in-command was murdered by one of his closest associates, the Nicaraguan Interior Ministry announced tonight in a lengthy communique.

Carpio, whose April 12 suicide was confirmed without details as to the place or the exact circumstances by a spokesman for the guerrillas' political front, represented the oldest and in many ways the most radical and intransigent of the five allied guerrilla factions fighting to overthrow the U.S.-backed government here.

His death, and that of his second-in-command, Melida Anaya Montes, on April 6, deprives his Popular Liberation Forces of its founder and key leadership at a moment when the rebels are seeking to unify the command structure of their overall organization.

Salvadoran leftists as well as the Nicaraguans had blamed the murder of Montes near Managua, Nicaragua, on the U.S. Central Intelligence Agency. But Nicaraguan sources said tonight that the Sandinista government in Managua has imprisoned four suspects in the killing, including one named Marcello Vassaglia, whom they described as "someone who worked closely with Marcial," Carpio's nom de guerre.

According to these sources, a woman who worked with Montes allowed Vassaglia and his companions to enter the house where she was staying in Nicaragua. They fought with her and killed her. The Interior Ministry had reported that her throat was slashed and that she had more than 80 stab wounds. Montes was in her 50s.

Carpio was in Libya at the time of Montes' death and flew back to Managua for the funeral and to find out what had happened. Reporters who saw him there described Carpio, who was in his 60s, as looking very old and sick and as wearing a sweater underneath a coat despite the intense heat.

There were conflicting reports tonight as to the exact manner and location of Carpio's suicide. Some reports had him dying in El Salvador and others in Nicaragua, where his body is buried. The delay in releasing word of his death, according to Nicaraguan sources, was at the request of other Popular Liberation Forces leaders who wanted time to notify their commanders and troops in this country.

The Interior Ministry finally made the announcement tonight at the request of the Salvadoran guerrillas, these sources said.

Notified of Capio's death tonight Salvadoran President Alvaro Magana said, "This is going to change a lot of things." He specifically suggested that there would be disarray among guerrillas currently waging an offensive in various parts of the country with the purpose of avenging the death of Montes.

The motives for the killing that set off this odd turn of events remains unclear.

U.S. officials repeatedly have accused the Nicaraguans of providing Salvadoran rebels with material support and with the use of Nicarguan territory for "command and control" of their operations in this country.

Carpio became well known here in the late 1940s and early 1950s as the leader of a militant bakers' union. He rose to head the Communist Party but split with it in 1970 because many of its other leaders refused to accept his view that armed struggle was the only way to fundamentally change Salvadoran society.