NEWARK, N.J. (AP) _ A federal judge on Wednesday refused to order an AIDS test for a key government witness in a trial of alleged mobsters, calling the request by defense attorneys an example of ''creative nonsense.''

The ruling came in U.S. District Court during pretrial hearings for 26 people, including alleged Lucchese crime family underboss Michael Taccetta, 38, of Florham Park.

The defendants, arrested in Florida and New Jersey, were indicted in 1985 with a variety of offenses under the federal Racketeer-Influenced and Corrupt Organizations Act, including cocaine distribution, gambling and credit card fraud. They are scheduled to stand trial Sept. 15.

Taccetta's attorney, Michael Critchley, argued on behalf of all the defendants, saying the witness, Joseph Alonzo, was an intravenous drug user who had been in prison and who once had a roommate who later died of AIDS, all reasons to suspect he might be infected.

''We are literally talking about life and death,'' Critchley said. ''The judge has the power and duty to preserve the safety of this court.''

Homosexuals and intravenous drug users most commonly contract AIDS, which destroys the body's ability to fight disease through its immune system.

A positive test for the antibodies indicates exposure to the disease but not necessarily te ailment's existence.

If Alonzo, a government informant in the federal witness protection program, had been found to have AIDS, the lawyers wanted a hearing on the kind of precautionary measures that should be taken in the courtroom.

Judge Harold A. Ackerman said the motion had no basis in law or fact.

The defense provided no medical evidence that, even if Alonzo had AIDS, precautions would be necessary in the courtroom, Ackerman said.

''Defendant's motion can only be viewed at best as an example of creative nonsense and at worst as an attempt to improperly influence'' the juror pool, the judge said.

The U.S. Attorney's office, joined by the American Civil Liberties Union, argued that the test was an unconstitutional invasion of privacy and an attempt to influence a potential jury.

Assistant U.S. Attorney Joseph G. Braunreuther said Alonzo has been in the witness protection program for 15 months with no sign of AIDS.

ACLU staff counsel Deborah Karpatkin submitted a New England Journal of Medicine article that says universal medical opinion is that AIDS cannot be spread through casual contact but only through injection into the blood or intimate sexual contact.