Peruvian troops killed as many as several hundred prisoners in battles at three prisons last night and today, virtually demolishing a pavilion seized by communist guerrilla prisoners yesterday and doing heavy damage to another that had also been taken by rebels.

Uprisings at two of the prisons were put down last night and the third, on an island off the port of Callao, was retaken this afternoon.

Local television showed only a pile of rubble remaining of the Blue Pavilion at the island prison, El Fronton, in which about 150 guerillas had been housed before the uprisings yesterday.

Authorities said the coordinated revolts were intended to embarrass the government of President Alan Garcia before a meeting here Friday of some of the world's socialist leaders.

A government communique early today said there had been "a large number of deaths" at Lurigancho prison, the country's largest, on the outskirts of Lima. About 300 rebel prisoners from the Sendero Luminoso (Shining Path) and other guerrilla groups were being held there.

Only 28 prisoners, said to have surrendered at El Fronton, were pictured on television. They were shown lying face down beside the prison's ruins.

A communique late in the afternoon said three military officers had been killed and four other officers and 16 soldiers wounded. There was no official word on the fate of two unidentified hostages reportedly taken yesterday inside Lurigancho, nor about four others reportedly seized at El Fronton.

At Santa Barbara, a women's prison in Callao, the government said all three hostages had been freed, two prisoners were killed and four other prisoners were wounded in the jail's recapture.

Savage fighting persisted for much of the day at El Fronton, an old facility on an island several miles off the coast from Callao, where Sendero Luminoso members are concentrated in a separate two-story block known as the Blue Pavilion. The government said its forces had encountered "strong resistance" from the mutineers, who had built barricades of cement and stone and were armed with explosives, dynamite and guns. A communique late this afternoon said there was still resistance and that the attorney general and a representative of the Supreme Court had gone to the prison to survey the situation and "to avoid further loss of blood."

The uprisings represented the most significant defiance of Garcia's authority since the president, 37, took power nearly 11 months ago. A Sendero campaign of killings and bombings has continued in Lima and elsewhere despite a state of emergency and a curfew imposed on the capital in February and already maintained for several years in a few highland provinces where the pro-Maoist movement began.

Security in the capital had been tightened for the meeting of the Socialist International, a world grouping of socialist and social democratic parties that had been expected to focus international attention on Peru. Garcia is due to address Friday's opening session.

Some Peruvian analysts saw the prison actions as a serious Sendero blunder, costing the movement its largest number of deaths since 1983, when the Army occupied the guerrilla stronghold province of Ayacucho. "I think they figured that with the international conference going on here, the government wasn't going to respond with such force," said Carlos Ivan De Gregorio, an expert on the insurgent movement. "It was a grave error."

But the crisis was also viewed as a blow to the government and an indictment of what several Peruvian analysts termed the absence of a coherent official approach to the guerrilla problem. Garcia, who took office stressing human rights and restraining military search-and-destroy operations against Sendero, had initially hoped to start a dialogue with the insurgents.

But Sendero, a fanatic band founded by university professors and students who gained support among Andean peasants, rejected all offers of negotiation.

The government has appeared reluctant to unleash the military on the rebels and slow to correct such festering problems as the concentration of captured insurgents in several Lima area prisons.