The American Medical Association weighed in yesterday against the Justice Department in the evolving legal battle over whether employers may discriminate against workers who have AIDS because of fear of contagion.

In a Supreme Court brief, AMA lawyers argued -- in contrast to a recent Justice Department opinion -- that a federal law on the rights of the handicapped protects victims of acquired immune deficiency syndrome and other infectious diseases from discrimination based on irrational concerns that they might spread illnesses to coworkers.

The brief argues that employment decisions regarding the handicapped should be based on "reasonable, individualized medical judgments" about whether the handicap allows a person to perform a job and about "the nature, degree and duration of risk" to coworkers.

The AMA filed its friend-of-the-court brief in a case that the Supreme Court has agreed to hear next fall involving a Florida teacher who was fired because she had tuberculosis. From the day the case was submitted, lawyers on both sides said they knew that the impact of any decision would be primarily on those with AIDS, not TB.

"All the lawyers who have been following AIDS are very, very aware of this case," said Nan D. Hunter, a staff attorney with the American Civil Liberties Union.

The 280,000-member medical organization decided to take a stand on the case because it has broad health policy implications, according to Benjamin W. Heineman Jr., a lawyer representing the AMA, who wrote the brief.

"The court will be establishing a framework for dealing with communicable diseases that affect millions of Americans," he said, adding that it is "an important case because the shadow of AIDS falls over it."

The teacher, Gene H. Arline, sued the Nassau County, Fla., school board after she was fired because of "chronic susceptibility" to tuberculosis. She charged that the action violated the Rehabilitation Act of 1973, which forbids discrimination against the handicapped by agencies receiving federal funds. The 11th U.S. Circuit Court of Appeals held in her favor, saying that tuberculosis was a handicap covered by the act.

The AMA brief differs sharply from a Justice Department opinion last month that a "handicap" under the law is limited to the effects of a disease on the person who has it and does not extend to possible effects on others.

In a memorandum to the Department of Health and Human Services, the Justice Department said that ability to transmit the AIDS virus did not constitute a handicap and that the law therefore did not protect AIDS victims from being fired because of fear of contagion. A footnote said that the same argument applied in the Arline case.

The AMA brief says this position "is incorrect as a matter of law and sweeps far too broadly. Although one effect of a handicap may be that it poses a risk of harm to others, employers should not . . . be allowed to discriminate irrationally against a handicapped individual based on a fear of such risk."

Allowing such discrimination "does violence to the fundamental congressional purpose . . . of protecting handicapped individuals from decisions based on fear, prejudice or stereotype," the brief said.

Controversy over AIDS in the work place centers on how the disease is transmitted. AIDS is a life-threatening illness caused by a virus that is spread by sexual contact with an infected person, by exposure to contaminated blood or from mother to infant during pregnancy or childbirth.

No case has been found in which AIDS was transmitted through casual contact, and the Centers for Disease Control concluded in November 1985 that "the kind of nonsexual person-to-person contact that generally occurs . . . in the work place does not pose a risk."

However, the Justice Department memo suggested that "conclusions of this character are too sweeping," provoking angry reactions from Health and Human Services officials who said they felt the lawyers were second-guessing medical experts.

The CDC reported that as of July 7 there have been 22,356 cases of AIDS with 12,239 deaths.