President Joao Baptista Figueiredo's campaign to move Brazil toward democracy after 17 years of military government has brought him into conflict with members of his own armed forces and is believed at the root of a continuing wave of terrorist bombings.

In less than a year, terrorist bombs have exploded at 24 leftist targets here. Brazilians have long suspected that the bomb throwers are rightist military officers, embittered by the presidential program of abertura, or opening to democracy, in Latin America's largest country.

These supicions were dramatically confirmed last month when a sports car blew up outside a May Day concert, killing the only passenger, an Army intelligence sergeant, and severely wounding the driver, an Army intelligence captain. Ten minutes later a second device exploded near a 25,000-volt transformer that provided power to the folk concert. There was no damage or casualties, but had the attack succeeded, the 20,000 youths packed in the closed hall might have panicked in the dark.

The attack had other marks of a well-planned conspiracy. Police investigators on the scene found two more bombs stored in the sports cars, a finding hotly denied the next day by the commander of Rio's 1st Army, Gen. Gentil Marcondes Filho.

In addition, a truckload of military police, requested by the promoters for crowd control, unaccountably never arrived on the night of the show. Finally, after the car exploded, the concert hall's private police stopped four cars racing out of the parking lot. All carried people with Army Ministry identification.

Shocked by the terrorism and fearing a sudden political swing to the right, Brazil's civilians have rallied massively behind Figueiredo, the fifth successive Army ruler since the conservative military seized power in 1964. Often held up as a liberal model for his more repressive Latin American counterparts, Figueiredo has amnestied political exiles, emptied the nation's jails of political prisoners, encouraged freedom of the press and scheduled elections next year for mayors, governors, and congressmen.

Fearing a setback after the May Day bombing, Brazil's five opposition parties took the unprecedented step of banding with the government party to back the president in a "national front" against terrorism. Figueiredo also had received wholehearted backing from the press, lawyer's groups, businessmen and the powerful National Conference of Brazilian Bishops.

"Not one, not 2,000 bombs will modify my decision in favor of the abertura," vowed Figueiredo in response to this show of support.

But critics note that Figueiredo said virtually the same thing last August when bombings killed a secretary in the Brazilian Bar Association, maimed a worker at Rio's municipal council chamber and damaged dozens of newstands that had ignored warnings against selling lefist periodicals. Unlike the leftist terrorist of the early 1970s, the rightists have not robbed banks or supermarkets to raise money, and none of the new bombers has been convicted by the courts.

Observers say the resurgence of bombings represents a bold challenge to Figueiredo and proof that he does not control powerful and growing conservatives currents in the ruling military.

"The serious thing is that now no one can close their eyes. All the proofs are there," said Fernando Gasparian, founder of Brazil's largest opposition party, the Brazilian Democratic Movement Party. "They have to be punished, but if the president punishes them, he faces a large rebellion within the military."

Casparian and other observers draw parallels between the present impasse and a crisis in Sao Paulo in 1976 over the torture of political prisoners. When a popular television reporter died in custody of Sao Paulo Army intelligence, then president Gen. Ernesto Geisel privately reprimanded the commanding general in Sao Paulo. Two months later a union leader died in Army custody. Geisel promptly sacked the Sao Paulo general, thus ending torture of political prisoners in Brazilian jails.

But Rio's Army commander, Gen. Gentil, apparently feels strong enough to brush aside presidential warning signals. The day after the May Day bombing, Gentil served as pallbearer for the dead sergeant, who was buried with full military honors. The bugle notes had barely faded, when the general hurried to the hospital to visit the wounded captain.

Repeatedly pressed to condemn the bombings, Gentil has only ventured to say: "The attacks are sporadic and haphazard. I don't think they will repeat themselves."

But Gentil's complacency may increase polarization here. In one of the largest demonstrations of recent years, 5,000 people marched down Rio's main avenue after the bombing, blocking rush-hour traffic, and, in deafening chants, demanded "the head of Gentil."

While the seesaw between generals and civilians continues, what appears to be at stake is a relaxed atmosphere of political freedom, notably absent in most of South Africa.

Reflecting the new chill in the atmosphere, only two days after the May 1 bombings, a concert promoter cancelled five shows planned for the end of May by North American folk singer Joan Baez. Last weekend, Baez attempted to give improvised concerts in Sao Paulo and Rio, but federal censors prohibited her from singing.

When Figueiredo was inaugurated two years ago, he promised Brazil's 120 million citizens to "make this country a genuine democracy."

Since then, the president, formerly head of the national security apparatus, has taken off his dark glasses, and now, like an elected civilian politican, he enjoys wading into crowds, kissing babies, slapping backs and bantering with reporters.

In the eased political climate, Brazil's five opposition parties have flourished, expanding networks of state and city chapters, and, until recently, competing for endorsements from prominent movie stars, musicians and soccer players.

The liberalized climate has also fostered a press that is one of the liveliest in Latin America.

A sensitive barometer of the political atmosphere is the Brazilian Communist Party, kept underground for 58 of its 60 years of existence. Last January, about a thousand people gathered for the advertised birthday party of Communist leader Luis Carlos Prestes, 83. According to newspaper accounts and photographs, Prestes stood in front of a poster of Lenin and served up slices of a cake baked in the shape of a hammer and sickle.

Despite these openings, Brazil's abertura had remained close to some sectors of society.

In a slap at Brazil's restive labor movement, a military court in February convicted the nation's most popular labor leader, Luis Ignacio da Silva, known as Lula, for leading an illegal strike. Although now free on appeal, Lula, who is president of Brazil's growing Labor Party, will be ineligible to run for public office because of his conviction.

Another group that has failed to benefit from the liberalization is the country's legislators.

"Congress is powerless. It's remunerated idlenes," says Cristina Tavares, an elected deputy for the Brazilian Democratic Movement Party. Indeed, a recent newspaper survey polled 141 deputies and found that 103 said Congress has "no power."

Since 1964, the survey found, Congress has approved 3,719 bills, while the executive office has issued 31.246 decrees. Stripped of power of amendment, the Congress has 45 days to approve or reject a bill. If no action is taken, the bill automatically becomes law.

But the bombings show that Brazil's radical right believes democratization has already gone to far.

After the bombings, rightist newspaper columnist Adirson de Barros, who prides himself on being the spokesman for the military's secretive "hard line" faction, listed the reasons Army intelligence officers are angry: the publication of lists of torturers, threats by "subversive organizations" to bring torturers to trial, and Figueiredo's amnesty, which "integrated guerrillas and exiles into society."

"The abertura hasn't in any way benefited the soldiers who fulfilled their duty, and today are ostracized . . . persecuted and with a price on their heads," de Barros warned.