President Clinton yesterday said he believes legislation requiring discharge of members of the military with the AIDS virus is unconstitutional, and he ordered the Justice Department not to defend the provision in court.

The Clinton order was part of a three-pronged effort by the administration to protect slightly more than 1,000 servicemen and women affected by a provision of the $245 billion defense authorization bill. Clinton also ordered that full military disability benefits be provided anyone discharged under the provision, and he vowed to work with Congress to repeal the law. The provision requires that members of the military who test positive for HIV, the virus that causes AIDS, be discharged within six months regardless of their ability to perform their jobs. After a person is infected with HIV, it takes an average of 10 years to develop AIDS.

Clinton believes the provision is "completely abhorrent and offensive," White House Counsel Jack Quinn said. Until the law is ruled unconstitutional or court action blocks its implementation, however, the law will be enforced, Quinn said.

"If the Congress chooses to defend this treatment of men and women in the military, it may do so; but this administration will not," Quinn said.

He said a legal test of the provision was "as sure as the sun will come up tomorrow," and predicted the courts would overturn it.

The provision, sponsored by Rep. Robert K. Dornan (R-Calif.), a conservative Republican presidential aspirant, was attached to the defense bill that the president is scheduled to sign this morning. Because the legislation includes a military pay raise and dozens of other key provisions, White House officials said, it is too important to the national defense to veto as several civil rights and gay rights groups asked.

The White House opposed the provision when it emerged in Congress, but Clinton never threatened to veto the overall bill because of it. Many in the administration thought it would be killed in a House-Senate conference and never become law.

Clinton yesterday endorsed legislation sponsored by Sen. Edward M. Kennedy (D-Mass.) and Sen. William S. Cohen (R-Maine) to repeal the provision. To give that legislation a boost, the White House and basketball star Earvin "Magic" Johnson released a letter that Johnson sent to House Speaker Newt Gingrich (R-Ga.) and Senate Majority Leader Robert J. Dole (R-Kan.) asking that the provision be repealed.

Johnson, who quit basketball after he was diagnosed as HIV-positive and then returned to the courts last week, asked their support for repeal for the military "who, like me, just want to do their jobs and provide for their families." He asked the Republicans to "do right by the 1,049 service members and stop ignorance, fear and prejudice from forcing them to retire."

Rep. Steve Gunderson (R-Wis.), who is gay, said he believes at least some of the Republican leadership in the House will support repeal of the provision. He said the provision was not thwarted earlier because AIDS activists and others believed they had a commitment in the Senate that it would be killed -- an expectation that was not fulfilled. Quinn said no one would lose their job "until the last possible moment." He and others said they hope Congress repeals the law before then, or that a court challenge is filed that prompts a judicial order to stop implementing the law until its constitutionality is tested. The Clinton actions drew strong praise from civil and gay rights groups. "This was a momentous step toward fairness," said Kim Mills, spokeswoman for the Human Rights Campaign, a gay and lesbian political organization.

Matt Coles, director of the American Civil Liberties Union AIDS project, said Clinton should have vetoed the legislation but that he took the next best step. "I think there is no question that singling out HIV-positive service people was done just to spite them. That is not legitimate."

Dornan has said it is unfair to let HIV-positive service members remain in the military because they are not eligible for combat or certain other duties, so other personnel must do such work. Paul Mero, Dornan's chief of staff, said Dornan welcomed the debate and any legal battle. "We think we will win, hands down," Mero told Knight-Ridder.

In deciding to keep the Justice Department from performing its routine job of defending a federal law, Clinton took an unusual but not unprecedented step. Several presidents have done the same, with the most famous case being a decision by Franklin D. Roosevelt to sign a defense spending bill during World War II despite a provision he believed was unconstitutional. The provision -- which called for blocking pay of several individual federal officials whom Congress viewed as radical and irresponsible -- was not defended in court by Roosevelt and was eventually ruled unconstitutional. The Clinton administration relied on a Justice Department ruling that the HIV law would only be constitutional if it "serves a legitimate government purpose," according to Assistant Attorney General Walter E. Dellinger.

Defense Secretary William J. Perry and Gen. John Shalikashvili, chairman of the Joint Chiefs of Staff, said to discharge HIV-infected service members who are deemed fit to perform their duties would be "unwarranted and unwise" and serves no military purpose. That conclusion, Dellinger said, leads to the conclusion that no government purpose is served by the provision.