SAN SALVADOR -- Speaking through loudspeakers, labor leader Julio Ramos stood at a courtyard lectern and listed leftist protesters' demands: salary increases, land for peasants, an end to foreign military aid and "a halt to North American intervention."

"We demand that North American imperialism and the Reagan administration accept responsibility for the underdevelopment of El Salvador," Ramos declared last Thursday in front of a building covered with antigovernment banners, posters and murals. The crowd of about 150 responded with chants: "Yankee capitalists get out!"

In many ways it was a typical Salvadoran leftist demonstration, but the setting was unusual, and the audience could literally be described as captive: It was inside Mariona prison on the outskirts of San Salvador.

A large red banner bearing the letters FMLN, the Spanish initials of the Marxist-led Farabundo Marti National Liberation Front, hung on the cellblock's facade, and various posters and murals glorified the guerrillas' struggle.

Prisoners accused of belonging to the FMLN virtually have the run of a section of the Mariona prison and regularly stage such rallies. They organize political activities in what seems to be a tolerant atmosphere.

During visiting day Thursday, prisoners entertained their families in their unlocked, doorless cells. In one cell, three prisoners played a video game with equipment donated by an American group.

But the prisoners have more on their minds these days than political rallies and entertainment. The National Assembly has passed a government-proposed amnesty law that promises to pardon perpetrators of political crimes from both the left and right. The vast majority of political prisoners here are leftists. Only a handful of people have been jailed for murders committed by rightist death squads and units of the military.

Leaders of the Committee of Political Prisoners of El Salvador, which claims 500 members in Mariona and runs the political detainees' cellblock, greeted the new law with a mixture of hope, skepticism and fear. In fact, some made it clear they might be safer inside Mariona's walls.

Ramos, a former union leader in the bread industry and president of the prisoners' committee, said the law was a "political necessity" for the government of President Jose Napoleon Duarte, which is seeking to show compliance with a Central American peace plan before a Nov. 5 deadline. But while he noted that the committee rejects the government's rationale for the amnesty and the inclusion of rightist offenders, he said the prisoners here would accept amnesty as a "popular triumph" brought about by leftist pressure groups.

Other committee members said they feared the possibility of being rearrested after leaving jail under the amnesty. Since it applies to offenses committed before Oct. 22, they said, persons arrested on new charges presumably would no longer be eligible.

Some prisoners said they also feared that they could become targets of death squads, which they say are back in business after having killed thousands of suspected rebel sympathizers in the early 1980s. News of the assassination last Monday of a leftist human rights activist, Herber Ernesto Anaya, caused great concern here, prisoners said.

"We are all afraid, and a dead person can't continue the struggle," said Celso Rivas, of the prisoners' committee.

Damian Ramirez, who runs the committee's legal bureau, said that if he was freed under the amnesty, he would probably go abroad, but he would not say where.

Ramirez, the only one of half a dozen committee members interviewed who admitted to membership in the FMLN, said he was captured in combat last May.

The prospect of amnesty for hundreds of political prisoners also seems to be causing some trepidation in the military, especially among prison guards here.

"The amnesty is dangerous for everyone," said Orlando Lopez, who has worked as a guard at Mariona for 16 years. The jailed rebels, he said "are going to go back out and kill more soldiers, plant more mines and burn more buses."

Lopez expressed frustration with the apparent leniency toward Mariona's political inmates, who he said keep trying to involve the common criminals in politics.

"It's easier to deal with the common criminals," he said, "because the political criminals are sick in the head." While they live in separate cellblocks, the political and common criminals mix in Mariona's large courtyard, a scene of fiesta-like activity on visiting days. Inmates and their families can eat under the canopies of establishments in the courtyard with names like The Fly's Leg Cafe and The El Paso, Texas, Coffeeshop.

In a gymnasium-like structure, huge speakers blared pop songs as prisoners danced with their visiting wives or girlfriends.

There is another side to life in Mariona prison. An Amnesty International study last year said that 90 percent of the approximately 1,000 political prisoners in El Salvador had been in custody for more than four years without a trial.

Five detained members of a leftist human rights group took advantage of the relatively free atmosphere in Mariona last year to interview 443 prisoners arrested between Jan. 1 and Aug. 31, 1986. All but two said they had been tortured, usually during the first two weeks after their arrest, before they were taken to Mariona.