The Supreme Court is studying government drug-testing programs, which are being challenged in two key cases as an unlawful "periscope" into the private lives of innocent people.

The court is expected to announce by July whether testing programs for many railroad and Customs Service employees violate their privacy rights.The two testing cases mark the first time the high court has confronted the constitutionality of drug testing in the American workplace.

The justices were urged by the Reagan administration Wednesday to uphold the drug tests. Attorney General Dick Thornburgh personally argued part of the administration's case, underscoring the importance attached to the issue.

But Thornburgh stumbled a few times when the justices asked him about details of the tests for railway workers.

"I'm not going to palm myself off on this court as an expert," Thornburgh said.

Thornburgh last argued before the high court in 1977 when he headed the Justice Department's criminal division.

"This is a case about railway safety," he said in defending mandatory blood and urine tests for railroad workers after accidents or rules violations.

He said the case was about "the hazards created by use of drugs and alcohol by those in charge of trains."

While Thornburgh encountered some problems Wednesday, his opponent in the case also faced sharp questioning.

Lawrence Mann, an attorney for the railway workers, said the drug tests are unconstitutional because they are incapable of proving on-the-job impairment.

For example, he said, the tests can show residue from a drug that may have been taken "by someone 60 days ago in the privacy of their home."

Justice Antonin Scalia asked if it weren't "reasonable for the railroad to want to know" if someone responsible for train safety has "cocaine traces" in their system.

The idea, Scalia continued, "is to prevent someone using cocaine from driving the train the next time."