A VISITOR returning to Brazil finds a mood of pessimism pervading that formerly buoyant, ebullient society. It is not a mercurial change, quickly reversible, but one shaped and depressed by decades of adversity and disappointment.Thirty years ago, Brazil was moving ahead. Concrete was being poured for the new, monumental capital of Brasilia, 600 miles inland from the good life of the Atlantic beaches and the fleshpots of the old capital, Rio de Janeiro. In a country larger than the lower 48 United States, a new start was being made toward a manifestly larger destiny. In Sao Paulo, now the world's second largest city, Latin America's biggest industrial center was taking shape. The saying, "God is a Brazilian," carried conviction. Ten years ago, a spirit of change again pulsed in Brazil. Time had been lost by quixotic and second-rate ideologues in the presidency. They followed Marxist models and beat the anti-Yankee drum to cover incompetence so staggering that the military seized power with the acquiescence of the middle class. By the mid-1980s the generals, defeated and discredited, were ready to withdraw. They peaceably allowed democracy to try again. But there has been no democratic solution. Today, people are voting no confidence in politicians and institutions. Tens of thousands of second- and third-generation immigrants, mainly from Portugal, Italy, and Germany, are getting those countries' passports. Most do not now intend to emigrate but say that they feel more secure with a second nationality. They are also thinking of their children who can then look around for opportunity in the European economy if recession persists at home. Many thousands with competitive skills have already left. A nd not only to Europe. One hundred and fifty thousand Brazilian Nisei have gone to Japan, sending money back to their families. US consulates are besieged by legal immigrants and by some 400,000 tourists per year, 50,000 of whom remain illegally in the US. Inflation is high, some 400 percent in 1991. Unemployment keeps rising, although with a good half of the national economy in the "informal" or black market sector, statistics are vague. There is nothing uncertain, however, about the decline in the quality of life. The middle class is shrinking. It eats worse and less, drawing into its shell, ashamed to admit poverty. Army colonels and police officials moonlight as taxi and truck drivers. Homelessness has increased. One friendly diplomat says one-third of the 150 million population is decently housed, one-third is ill-housed in the favela shantytowns, and one-third has virtually nonexistent housing. Some 7 million street children, 7,000 of whom were killed by vigilante death squads in the past year, are blamed for much of the street crime that plagues Brazil's big cities, especially Rio de Janeiro and Sao Paulo. Drugs is a growing problem as the narco-traffickers who have used Brazil as a transit route now seem to be creating a market there. People, disgusted with hollow promises, say they dislike and mistrust their political leaders. Corruption is described as a curse, spreading from top to bottom and across the board. The new, young president, Fernando Collor de Mello, elected in 1989 with high hopes, has done little better than his incompetent predecessor. With more than three years left in office, he is already called a lame duck. He and congress are deadlocked in search of the magic bullet to end inflation and stagnation. So far, they have only shot the country in the foot. All the while, basic, long-term needs are neglected, none more than education, the key to the future. Public, primary, and secondary schools are a disaster with underpaid teachers turning out illiterates. (Brazil's functional illiteracy rate is put at 60 percent.) Even the poor scrape and save to send children to private schools. Most of the central government's money for education goes to the federal universities. They, too, are declining, strangled by bureaucracy. In structure as well as performance, Brazil is not coping. The electoral system, proportional representation, favors democracy on paper but stifles it in practice. Most of the 19 political parties are local political clubs serving local interests. Only a handful have nationwide status and serious programs. The Constitution is crammed with unmanageable detail. The courts are, at best, lethargic. The protectionist and state-ridden economy is just beginning to open up. Social inequality is scandalous, racia l discrimination endemic. Both impede progress. Brazil deserves better. It is rich in resources, its people intelligent, hard-working, adaptable, not given to violence. Mexico and Argentina can, democratically, pull themselves out of their morass. Brazil should certainly be able to. But first it must find its way - and that has not yet happened.