An apparent miscalculation by a leftist guerrilla group about how Peru's populist president would react to the takeover of three prisons last week led to the Sendero Luminoso (Shining Path) movement's most serious blow in six years of fighting the government.

But the swift action ordered by President Alan Garcia to quell the uprising has created new political problems for Garcia as opposition parties today demanded an investigation into what they called a "massacre" by the armed forces.

Late tonight, Garcia ordered a military investigation into reports that troops shot and killed prison inmates who had surrendered during the uprisings. A communique from the presidency said: "In the actions at Lurigancho prison, the number of dead of 124 indicates that excesses were committed in the use of force to fulfill the government's orders." It said anyone found guilty of the "excesses" would be punished.

Garcia is said to believe that the killing of, at latest count, 266 imprisoned Sendero members who participated in the revolts at three prisons has seriously crippled the group's ranks.

Among those who died when armed forces and police stormed pavilions seized by inmates at Lurigancho, El Fronton and Santa Barbara prisons were several of the group's top leaders.

Peruvian specialists on Sendero said the apparently coordinated uprisings were a strategic error that cost the movement its largest number of dead in any operation. They also contended that guerrillas probably assumed that by timing the rebellions to coincide with the meeting of the Socialist International here this weekend, they would inhibit Garcia from moving forcefully against them for fear of adverse international reaction.

But despite its defeat, which resulted in the death of nearly all its imprisoned members in Lima, Sendero is widely expected to remain a threat, and leftist political leaders said today that rather than reduce the threat of terrorism, the government's massive and swift quelling of the prison rebellions is likely to raise the level of violence here.

"The outcome of this barbarous action will not be pacification," said a communique published today by the United Left, a coalition of parties that constitute the second largest political group after Garcia's Popular American Revolutionary Alliance. "It will only speed the spiraling violence, the attacks, the selective assassinations and the resulting dirty war."

In another of a series of bombings and killings that have kept tensions high in the capital, 130 pounds of dynamite exploded at dawn today in a car parked in a wealthy suburban neighborhood of high-rise buildings and shops. The explosion blasted the ground floor of a bank office and broke windows in a two-block radius.

The opposition statement, which was signed by the heads of six leftist parties and Lima Mayor Alfonso Barrantes, the coalition's president, said the government should have sought the help of the Roman Catholic Church or relatives of prisoners to mediate.

"We express our most energetic condemnation of this massacre, demand an urgent meeting of the Permanent Commission of Congress to approve an investigation . . . and demand the most severe sanctions for those responsible."

Government officials have said efforts to persuade the rioting inmates to surrender were rejected. But at a press conference today, Sen. Javier Diez Canseco, who leads a Marxist party, said attempts by civilian authorities to intervene at the prisons were blocked by the military.

Without naming the sources of his information, Diez Canseco, whose party has members jailed for terrorism at Lurigancho, accused the military of having executed up to 60 Sendero rebels who tried to surrender early Thursday morning.

Many details of the siege have not been reported. Only brief official communiques were issued and the government made strong efforts to restrain Peruvian television, radio and newspaper reporting.

For some months, authorities have sought to play down news reports of terrorist actions, apparently believing that media coverage had encouraged the guerrillas. But the government appeared to take its restrictive press policy a step further last week, using the crisis to confiscate all the issues of a recently started pro-Sendero newspaper, El Nuevo Diario.

In the absence of full disclosure about the decision to invade the cellblocks, there has been speculation, particularly among foreigners, that Garcia may have been pressured by the armed forces to send troops to retake the penitentiaries.

Since the assassination by Sendero in early May of a Navy rear admiral, Garcia has come under increased urging from the military to give them greater leeway in fighting the insurgents. The officer, a member of the office of the naval chief of staff, was the most senior military official slain by guerrillas since the Sendero insurgency began.

But the possibility that Garcia, who has been in office nearly 11 months, was pushed by the military into ordering the prison assaults is dismissed by many Peruvians, who contend that it was in character for the president to have decided on such action on his own.

The president has publicly defended the forceful action to quell the prison uprising, saying it was necessary to avoid the appearance of weak government in the face of a major terrorist threat. He is reported to have been concerned at reports that the rebels had enough food and provisions in their cellblocks to hold out for several days.

A source close to Garcia said that the president had figured that the number of casualties would be around 50, apparently underestimating by five times the result of ordering in the military.