Brazilian President Ernesto Geisel ended speculation over who will succeed him by naming Gen. Joao Baptista de Oliveira Figueiredo today as the official candidate in the indirect elections later this year.

The announcement came amid signs of military discontent. Geisel's chief adviser, Gen. Hugo de Andrade Abreu resigned yesterday in what was taken as a protest against the choice.

Figueiredo, 59, now head of the National Intelligence Service, will be the fifth army general to hold power since a military coup ended civilian rule here in 1964. His nomination is certain of the official ARENA party and ratified by the electoral college in dominates.

Naming of Figueiredo comes after nearly a year of maneuvering by military factions. In the Brazilian political context, Figueiredo is considered a mr erate, and his candidacy has been vigoroussly opposed by hard-line elements.

Figueiredo is virtually unknown to the public. A poll published today showed that less than half the people in Rio, where Figueiredo was born and where he later comanded the military's intelligence forces, have been heard of him.

"Once again," complained a newspaper here, "Brazil has as candidate for the presidency a general about whom the vast majority of the populace cannot even write 10 lines in a letter to a faraway friend."

Exactly where Figueiredo stands on key political and economic issues is also a mystery, although some political observers are already predicting a "democratic opening" because of the general's unusual upbringing. His father, Gen. Euclydes Figueiredo, led the opposition to Getulio Vargas' dictatorship in the 1930s, and later helped found the National Democratic Union, a liberal constitutionalist party.

These observers are also taking as a hopeful sign Geisel's decision to pick a civilian, Aureliano Chaves, as Figueiredo's vice presidential running mate. Chaves, 49, is an engineer and governor of the politically important state of Minas Gerais.

Leaders of Brazil's only legal opposition party, the Brazilian Democratic Movement, and other government critics remain skeptical of Figueiredo, however.

"Since when is the democratic spirit transmitted through the genes?" one anti-Figueiredo figure asked.

Neither military nor civilian opposition is seen as strong enough to prevent his accession to the presidency on March 15, 1979.

Senate President Jose de Magalhaes Pinto of Minas Gerais, a civilian member of ARENA, has been running for president for six months. Although Magalhaes Pinto is given no chance of winning the ARENA nomination that is tantamount to election, he had pledged to take his quixotic campaign to the party's convention.

That would introduce an element of potential divisiveness that the ARENA leadership would like to avoid. Magalhaes Pinto is now under considerable pressure from party leaders to "desist" from his campaign.

It has been reported that should he refuse, the rules of the convention will be changed to prevent him from putting his name in nomination.

Until recently, military hard-liners had been supporting Army Minister Sylovio Frota.In October, Geisel - who is said to favor gradual liberalization and eventual return to civilian rule - left them without a candidate when he fired Frota.

According to press reports, Gen. Abreu told Geisel before stepping down yesterday that the Figueiredo nomination is "a violation of bierarchy" that "does not have the support of the army." Government spokesmen have termed the Abreu action an "isolated instance" of disagreement among the high command.

Word that Geisel had decided on Figueiredo first leaked out in July, when Geisel's closest civilian adviser announced that "when the time comes, I will be at the side of the Figueiredo candidacy."

Since then, Figueiredo has made a point of keeping a low profile, at one point telling reporters that they should "pretend I had a heart attack and died."