If President Carter hoped to corner Puerto Rico's 41 delegates to the Democratic National Convention by freeing four Puerto Rican terrorists last week, he might better have kept them in jail.

Like so many things on this crowded island, the nationalists have become embroiled in the issue of whether Puerto Rico will remain a commonwealth or become a state.

The ruling New Progressive Party wants statehood. Carter's Democrats here want statehood (although Carter himself remains publicly uncommitted), and Carter's people have been firmly in control of the delegate-selection machinery.

Carter therefore looked like a cinch to win the 41-delegate package at state in Puerto Rico's March 16 primary, which would be a bigger boost than 30 other states or territories could offer.

But then two things happened. A certain Massachusetts Democrat began looking more and more like a presidential candidate. And Carter decided to free these men and one woman who had been in federal prison since the 1950s for their armed assaults on President Truman and Congress.

Those here who remembered the four nationalists at all generally favored the release on humanitarian ground. The four -- Oscar Collazo, Irvin Flores Rodriguez, Rafael Cancel-Miranda and Lolita Lebron -- had served longer than any other federal inmates, and, it appeared, had mellowed over the years.

Appearances were wrong. Once free, the nationalists promptly said they would quite literally die before accepting statehood and implied that lots of other Puerto Ricans -- and people on the mainland -- might die too. "I hate bombs but we might have to use them," said Lebron, 59.

"This may have backfired on Carter," said Gov. Carlos Romero Barcelo in an interview. The 3.3 million islanders, jammed together as densely as the people of Japan or India, are basically tolerant, hard working and broadly middle class in aspiration. The island is poor -- average income $2,800, half that of Mississippi -- and bereft of natural resources.

Many of the pople, an estimated 22 percent last year, are unemployed, but most of them are not angry. The independence forces, denouncing U.S. imperialistm, have never mustered more than 6 percent in any vote.

To have loosed possible violence on such an electorate cannot help Carter here, in the governor's opinion.That possibility may not hurt statehood, however, Romero says, paradoxically telling reporters, "violence will strengthen the statehood drive." That has been true in the past.

"Statements about revolutionary tactics and violence get people more into the security syndrome," said Franklin Delano Lopez, who with White House help took over the local Democratic machinery last year and hitched it to the statehood bandwagon. He thinks voters will remember Carter's freeing of the nationalists as compassionate.

But others in the statehood camp have not-so-subtly disociated themselves from Carter, especially as Sen. Edward M. Kennedy (D-Mass.) has edged closer to candidacy. Delano Lopez survived a challenge to his party leadership only by agreeing that convention delegates may be formally uncommitted if they so choose.

The new Democratic national committeeman here, Baltasar Corrada del Rio, has openly expressed a preference for Kennedy.

"If Kennedy runs, it's disaster for Carter," said Carlos Chardon, secretary of education and a confidant of Romero. In the mountain shacks and farmhouses of upcountry Puerto Rico, tapestry portraits of the late President Kennedy abound alongside those of Jesus and the Pope. The Kennedy name is magic.

These developments have delighted Romero's opposition, the Popular Democratic Party. They see the upcoming primary as a chance to regain control of the Democratic machinery they lost to Delano Lopez last year, and also as a chance to give statehood a drubbing.

The Populares invented the island's current commonwealth status in the 1930s as sort of a halfway house between statehood and independence. Puerto Rico had been run as a colony from the mainland since the United States took it from Spain in an armed invasion in 1898. But to populist leader Luis Munoz Marin, statehood meant destruction of Puerto Rican culture.

Under his compromise, Puerto Ricans have U.S. citizenship, use U.S. currency had the U.S. mails and courts. They are defended by U.S. military bases and receive U.S. welfare, food stamps and Social Security benefits.

But they can't vote in mainland elections, only in local primaries. As a corollary, islanders pay no federal income tax. They are free, however, to move to the mainland, vote and pay taxes there.

Puerto Ricans sing their own national anthem before their own flag. They are resolutely Spanish-speaking, with a Latin street life and a free, colorful press. They are so Latin, in fact, that Munoz Marin, now 82, and his Popular Democrats fear that any bid for statehood would result in a humilating rejection by the U.S. Senate.

Congress, they say, would think three or four times about admitting a new state so poor that 60 percent of its people are on food stamps. Racially, most Puerto Ricans are a mixture of the Spanish conquistadores and black slaves they brought to cut sugar cane in the 1500s; agriculturally, the island must import nearly all its food.

Even the plantains, staple of the tropics, and the molasses for the island's famous rum come from the Dominican Republic, where wages are one-fifth as high as here. Only one-third of this land can be cultivated; the rest is dense mountain jungle.

Puerto Rico as a state would jar national politics, bringing in 2 million Spanish-speaking voters, two new senators and seven new representatives, probably all Democrats. This is more House members than 27 states now have. It would be eligible for billions in grants but its poor population would not contribute nearly that much in taxes.

And now the nationalists have sworn to fight statehood to the bitter end. Most observers give them little chance of uniting the island's divided independence movement; Independent Party chief Ruben Berrios also has refused to take part in a Sept. 23 rally with the nationalists and the Puerto Rican Socialist Party. But Berios warned last year that frustrated Independenistas could be expected to react violently if the island moves toward statehood.

And although violence might push security-minded Puerto Ricans further toward the mainland, it would be likely to kill any statehood chance in the U.S. Senate, according to Alex Maldonado, pro-commonwealth managing editor of the newspaper El Mundo.

So the commonwealth forces, convinced that Carter is vulnerable, are eagerly gearing up for the primary. Led by former governor Rafael Hernandez Colon, they are prepared to offer ABC (Anybody But Carter) delegate candidates but hope openly that Kennedy runs. Then, according to one scenario, they could tie their commonwealth movement to the Kennedy cottails, regain control of the party and have a good start toward the 1980 gubernatorial election.

Kennedy has not said what he prefers for the island's future. It is probable that he, like Carter, would pledge to abide by the islanders' choice in some kind of referendum after the 1980 election.

The ruling Progressive Party is convinced that islanders would vote for statehood then and that the Senate would grant it.

"Congress is sophisticated enough to distinguish between a few terrorists and the mass of Puerto Ricans," said education secretary Chardon. Statehooders add that Congress would not risk international denunciation by refusing its former colony entry.

But the referendum will have to wait until after the 1980 vote. Gov. Romero, a brawny, silver-haired lawyer whom a local satirist once called "The Incredible Hulk," has honored a respectable number of his 1976 campaign promises and has kept very visible.

He takes a helicopter to some remote village twice a month, kissing babies and listening to complaints. More than 3,000 supporters paid $150 each to attend his 47th birthday party Friday night, raising $400,000 for the campaign.

He is undisputed master of his party, but the Popular Democrats are now masters of theirs. This is a change from a year ago, when commonwealth forces were divided and rudderless, with no candidate and no platform. Now the opposition is united behind Hernandez Colon -- "on the surface, at least," Romero observed -- and Romero has been the center of some minor scandals that could hurt him.

Two young independentistas apparently preparing to blow up a communication tower on Cerro Maravillas were killed in a fusillade by police last year in what looked like a trap. Romero called the police heroes, but the Justice Department is investigating a report and is expected early next year.

When Romero pointed out some problems with property tax deductions on Hernandez's tax returns, Hernandez demanded that Romero publish his own. It was thereupon discovered that the governor had wrongly deducted $60,000 in alimony payments from his income over a 10-year period.

None of these wounds is mortal or even very serious for the popular governor as yet. He opposed freeing the four nationalists without some promise of good behavior, and is now being praised for that. But the Popular Democrats are more optimistic than they have been since 1976 that things may be going their way. And that cannot be good news for Jimmy Carter.