CAMPINAS, BRAZIL -- Late one Friday afternoon last month, a 31-year-old homosexual with AIDS visited a local treatment center feeling depressed.

He had murder on his mind. Lonely and distraught, he had been planning a sexual binge to spread the fatal acquired immune deficiency syndrome widely through Campinas, a city of 850,000 about an hour's drive north of Sao Paulo.

Silvia Bellucci, an immunologist at the center, recognized the killer urge. She had seen the same impulse numerous times before in other AIDS victims, this macabre wish to pass the deadly virus to unsuspecting others.

She also knew the visitor from his attendance at group therapy sessions. He is a systems analyst at a data processing firm, the father as well of two daughters. Three years ago, he began having homosexual relations and got AIDS.

Soothingly, Bellucci comforted the would-be murderer and drew him back to his senses.

"He sat right here on the couch," the doctor recalled during an interview in her large outer office. "It was his birthday and he said he was feeling sad and anxious. No one had done anything to celebrate the day. He started crying and said he had been thinking of going out and spreading AIDS to at least 50 people. I cried with him, and then we talked for an hour and a half until he calmed down."

Second to the United States in the number of reported AIDS cases, Brazil is now confronting the threat of willful transmission of the disease. Medical experts here say the desire to spread the incurable virus occurs in victims elsewhere but seems to have received more widespread publicity in Brazil.

Simply identifying the sufferers of AIDS and easing the physical pain of their final days is said to be insufficient both for the victims and for everyone else's protection. The illness demands psychological care. But in developing countries like Brazil, already hard-pressed to provide even basic medical services, the complications and traumas of AIDS go largely untreated.

In one unpublicized case two months ago, according to the center where Bellucci works, a 29-year-old drug addict who knew he was close to dying of AIDS gave a party in Campinas. Without confessing his condition, he passed around a syringe of cocaine diluted with his own infected blood, exposing about 20 people, ranging in age from 15 to 25, to the risk of contamination. They are now being seen at the center.

In the southern city of Florianopolis, residents have been terrorized for two weeks by a police report of a purported pact among a small group of confessed drug addicts to disseminate AIDS. An 18-year-old girl caught stealing furniture from an apartment building where she lived told authorities of the alleged plot. She identified a married couple as the ringleaders.

They were said to have hosted drug parties at which they mixed their AIDS-infected blood with cocaine and used a single syringe to inject the poison into others. Some infected group members also are reported to have taken to prostitution to transmit the virus and raise money.

The accused have denied scheming to spread AIDS. As authorities try to establish the truth, Brazilian newspapers say Florianopolis is in a panic and swirling with wild rumors -- that, for instance, up to several hundred people may have fallen prey to the reputed plotters, that members of some prominent families are among those victimized and that schoolchildren were fed contaminated chocolates by the group. The virus is not transmitted through foods.

Behind the urge to inflict AIDS on others lies a combination of sadistic and masochistic impulses, doctors say. Resentment against society merges with loneliness, despair and disgust with oneself.

"It is a mix of wishes to contaminate others and, as a kind of self-punishment, to be re-contaminated," said Margo Mair Marques, a psychologist who treats AIDS victims in Campinas. "It is usually a phase, part of the ups and downs of coming to terms with the disease. The urge may be triggered by a variety of situations related to a person's relationships or personality."

Often, the impulse is not explicitly articulated but exists subconsciously. "Some victims knowing they have AIDS keep behaving as if they were not infected," said the psychologist. "Others say they are not worrying about the consequences of their actions. They say they couldn't care less about passing on the disease. That's really a kind of masking of the intention to infect others."

Public insensitivity to those with AIDS has aggravated the problem, according to medical experts. Along with a growing awareness in Brazil this year to the dangers of AIDS have been reports of infected persons being expelled from jobs, run out of towns or hunted down by police. Recently, health officials ordered clinics to start reporting the names of anyone tested positive for AIDS antibodies.

Such measures are said to drive victims of the illness deeper into depression and emotional backlashes. Some end in suicide. In Sao Paulo, Brazil's largest city and the one where the majority of known AIDS cases are concentrated, 60 AIDS victims killed themselves in the first six months of this year, according to unpublicized statistics kept by a medical law institute.

"Others start to rebel and to spread the virus more than if AIDS were treated with greater sensitivity," said Bellucci, who has been working with AIDS patients since Brazil's first cases surfaced five years ago. She urges more psychological attention for AIDS victims to combat what she calls the "AIDS ghost," an obsession with this disease that so far is considered inevitably fatal.

The Center of Immunology Control and Investigation, which Bellucci helped to establish in Campinas, has become a national model in counseling those afflicted with the virus.

Like other countries, Brazil was slow to react to the rising count of AIDS sufferers. The government took concerted action last February, launching a series of TV ads with instructions on preventive measures.

The effort brought talk of sexual habits into the open. But federal budget cutbacks and pressure from the Roman Catholic Church resulted in a briefer, less explicit campaign than planned. Many of Brazil's poor and illiterate never got the message.

In recent months, responsibility for combatting AIDS has fallen largely to state and local authorities, employers, the media, doctors, religious organizations and volunteer groups. There is a consensus that the country's best defense against the illness rests in expanded education programs. But experts are still searching for effective ways to explain AIDS to a nation where sex education is banned from most public schools and where many people know only crude slang terms for such words as condom, sperm and homosexual.

"Awareness of AIDS has increased dramatically in middle- and upper-income groups, but is still low in large poorer parts of the population," said Evahyr Lyra Jr., head of health-care products at Johnson & Johnson in Brazil, the dominant local manufacturer of condoms. "Some concepts are proving too tricky for mass communications."

By the end of September, the total number of reported AIDS cases in Brazil had risen to 2,102. Current rough estimates of the number of Brazilians thought to be carrying the AIDS virus range from 300,000 to more than 500,000. Nevertheless, Brazilian health officials remain divided over just what priority to assign AIDS in relation to other, older diseases that continue to affect millions of people in Brazil, including malaria, dengue, leprosy and Chagas disease.

Of particular concern nationwide is the contamination of blood supplies. Despite a Health Ministry order in May requiring blood banks to test for the AIDS virus, doctors estimate that at least 70 percent of private donor operations are still not screening banks, due to a shortage of imported testing kits and the expense of testing. Some hospitals have stopped accepting blood from private banks and refuse to use nationally manufactured plasma products.

"We know what should be done in education and control against AIDS, but there's neither sufficient intensity nor continuity in official programs," lamented Vicente Amato Netto, superintendent of the Hospital of Clinics in Sao Paulo and a member of the national commission on AIDS.