Only months away from a landmark presidential election, Brazil has embraced all the outward show of a Latin political campaign even as the choice of its first civilian government in 20 years unfolds behind closed doors in this modernistic capital.

Mass rallies have gathered tens of thousands of supporters for the favored opposition candidate, Tancredo Neves. Hecklers have besieged the official choice of the military-backed government party, Paulo Maluf. Military commanders have warned against the "radicalization" of the election mobilization. News agencies have produced a flurry of sometimes conflicting public opinion polls.

The most telling image of this familiar spectacle might nevertheless be found in a small office here where Saulo Quieroz, a federal congressman, is housed with his personal computer. Quieroz has compiled a detailed record of every actual voter in this nominally democratic election: that is, the 686 congressmen and state delgates composing a special electoral college that will meet on Jan. 15.

Each day, while the candidates pronounce on the issues and their headquarters design media events, the electronic printer in Quieroz's office buzzes with the results of the real calculations of this peculiarly indirect election: electors by party, electors by state, electors declared, electors undefined.

"In a closed system," said Quieroz one recent morning, brandishing a printout, "this is the real campaign. The other outside -- that's the warm-up act."

The mix of bombast and the computer's quiet accounting provide a hint of the complexity underlying the political transition in Latin America's largest country. Laced with improvisation and yet smoothly attuned to the military's 10-year program of slow democratization, Brazil's election combines popular participation and military authority with a more subtle backroom struggle among its civilian elite over the nation's long-term future.

The military and Brazil's 130 million people are now only incidentally involved in this process. The military designed and weighted it in favor of the official Social Democratic Party in hope of maintaining control of until 1991.

Economic crisis and the armed forces' own political exhaustion, however, have combined to convert the election during the last year into a ratification of the military's withdrawal from formal political power. Both candidates are independent of the armed forces in their programs and bases of support.

Maluf, ostensibly the government's candidate, managed to win nomination over the opposition of outgoing President Joao Figueiredo, who like all presidents since a 1964 coup is a retired general.

The armed forces' elaborate election system, said political scientist Alexandre de Barros, "just didn't work -- and they are as flabbergasted by that as we are." He added, they "will continue to set the limits of action for the government. But what become the limits in each area will be something that's negotiated for a long time."

The Brazilian public appears to have a similarly arbitrative role. While a popular nationwide campaign for direct presidential elections was unsuccessful, the mobilization and subsequent demonstrations for Neves have helped provoke a split in the government party and made the opposition coalition a sudden favorite.

"The new government will be semiparliamentary, in the sense that the basis of its election will be the Congress," said Fernando Henrique Cardoso, a leading senator of the major opposition party, the Brazilian Democratic Movement. "But if it does not adopt policies that are popular among the masses, it could very quickly be faced with an unmanageable situation."

Despite such predictions, policy and even ideology have so far played only a secondary role in the scramble for electoral votes in Brasilia. For most politicians, the real issue has instead become the future of the nation's still evolving political system and the nature of the civilian leadership that will conduct it.

There is little question that major changes lie ahead. Both Maluf and Neves have promised to revise the constitution, restoring power to the Congress and curtailing the authoritarian powers granted by the military to its presidents. Each has also pledged that his successor will be chosen in a direct popular election, and Neves has said he will shorten the six-year presidential term to three years and convoke a constitutional assembly in 1986.

The new president is also likely to preside over a restructuring of Brazil's political movements and their leadership. Restricted for two decades, the political elite has remained static.

In this context, ironically, it is Neves, 74, the opposition candidate, who stands for the preservation of Brazil's traditional political establishment. A former prime minister and state governor first elected to public office 50 years ago, Neves has assembled a coalition that faithfully represents the spectrum of civilian political elites as they existed before the military took power -- including many of the same personalities.

Since July, Neves' supporters have included more than 40 congressmen, an array of governors who have broken with the ruling party, Vice President Aureliano Chaves, and historic opponents of military rule.

Maluf, 53, in contrast, represents a threat to both the reigning political order and the statist development policies pursued by civilian and military governments since World War II. A congressman and former governor of Sao Paulo state, Maluf has made his political career as an outsider, winning elections and nomination by the ruling party through sheer personal drive.

Many politicians describe the resulting electoral competition in terms that are more social than political, with Maluf appearing as the newly rich, pushy outsider trying to unseat the pedigreed club president. Neves "represents every sector. He represents experience, honesty, respectability and credibility," said Fernando Lyda, an opposition congressman. "Maluf is insistent, persistent, obstinate and impertinent. He gives you a hug whether or not you want one."

Maluf is also the underdog. With Neves' alliance dominating the political center and left, Maluf has been able to count only on conservatives who support him ideologically and die-hard loyalists of the government party. Even President Figueiredo has seemed lukewarm.

Nevertheless, one of Maluf's supporters in the Senate said, "It's very uncertain. This is not the general population voting, it's politicians. And politicians like to negotiate until the last minute."