The Supreme Court, in a move that could indicate its views on drug testing of federal employes, allowed the U.S. Customs Service yesterday to reinstate a mandatory drug-testing program similar to one ordered last September by President Reagan for an estimated 1 million federal workers.

The court, with Justice William J. Brennan Jr. in lone dissent, issued a one-sentence order saying it would not halt the program while an employe union appeals a federal appeals court ruling allowing the tests.

The action is the court's first in a case involving mandatory testing of federal employes and means that Customs can resume testing anyone seeking a job or promotion in certain "key" drug-enforcement positions.

In another ruling, the court sidestepped review of one of the most widely criticized decisions in its history. The justices ruled unanimously that a lawsuit brought by Japanese Americans interned in World War II relocation camps should be considered first by a lower federal court.

The drug-testing case began when the National Treasury Employes Union (NTEU), which represents the Customs Service's 9,000 employes, asked the high court to halt the tests at least until the justices decided whether to hear union arguments.

The union contends that random testing -- that not based on a suspicion of drug use in an individual case -- violates Fourth Amendment rights against unreasonable searches.

The NTEU has also filed suit, pending in U.S. District Court in New Orleans, to block Reagan's more extensive program, which calls for random drug testing of federal workers in "sensitive" jobs.

A Justice Department spokesman said most federal agencies are devising plans for testing under that program, announced in an executive order last September.

NTEU President Robert Tobias said that, despite the court's action, he is hopeful that the justices will agree to the union's request that the court hear their appeal this month, even though the court finished its argument calendar for this term last month.

"I'm disappointed by the fact that the court failed to grant the stay," he said, "but I don't believe it indicates how the court will rule on the merits."

Government officials, saying they feel that the court action may reflect willingness to allow mandatory drug screening, were heartened. Customs Commissioner William von Raab said "drug screening is necessary to ensure that the people we hire and entrust with the enforcement of our nation's drug laws are not drug users themselves."

Customs spokesman David Hoover said testing is to begin today.

The opinion involving the Japanese-American internees was largely confined to a technical legal issue. The high court said the case should not have been heard by the U.S. Court of Appeals for the District of Columbia.

That court had said victims of the forced evacuation could sue the government for losses incurred when forcibly removed from their homes shortly after the attack on Pearl Harbor.

Justice Lewis F. Powell Jr., writing for the court in U.S. v. Hohri, reversed that, saying the claims should have been reviewed by the U.S. Court of Appeals for the Federal Circuit. That court was created in 1982 specifically to review patent appeals and claims against the government. Powell threw out the original appeals court ruling ordering a trial on the claims.

Benjamin Zelenko, an attorney for the Japanese Americans, said he is "disappointed the court did not reach the merits" of his clients' claims that the normal six-year statute of limitations on such suits did not apply because the federal government concealed information from the Supreme Court when it upheld the internment in Korematsu v. U.S. in 1944.

"We're alive," Zelenko said, "but this means we are not going to get a trial" for some time. The court's action, he said, "just postpones it further for people who have waited so long for justice."

In the drug-testing case, the Customs Service tested 740 employes and applicants from July 1986 to November 1986, when a federal judge in New Orleans declared the plan unconstitutional. The judge said the program's monitored urine collection was "degrading" and an unreasonable search.

A divided three-judge appeals court panel reversed him April 22, saying the government's interest in screening employes involved in drug enforcement activities outweighs the program's "limited intrusiveness." It rejected union arguments that the agency failed to show a need for the program and that the program was ineffective.

Most state and federal courts reviewing mandatory drug testing have issued conflicting opinions on the question, although many have frowned on plans that require testing without probable cause or at least a suspicion that an employe is using drugs.

The Supreme Court recently declined to review a ruling by the 3rd U.S. Circuit Court of Appeals in Philadelphia that upheld random testing for jockeys and in 1976 declined to review a ruling by the 7th U.S. Circuit in Chicago that permitted testing for bus drivers involved in accidents.

In other action yesterday, the court:

Handed organized labor a major victory, ruling, 6 to 3, that a new employer taking over an existing business has an obligation to bargain with the existing union.

Justice Harry A. Blackmun's opinion in Fall River Dyeing & Finishing Corp. v. National Labor Relations Board was joined by Brennan, Thurgood Marshall, John Paul Stevens, Antonin Scalia and, in part, Byron R. White.

The ruling upheld an NLRB determination that, after rehiring many of the prior owner's workers, new owners of a Massachusetts textile plant were obliged to bargain with the union that had represented those workers.

Ruled, 5 to 4, that no federal laws bar states from requiring employers to give severance pay to workers who lose their jobs as a result of plant closings. Brennan, joined by Marshall, Blackmun, Powell and Stevens, wrote for the majority in Fort Halifax Packing Co. v. Coyne.

Reinforced prison officials' power to regulate inmates' conduct by ruling, 4 to 4, that Missouri officials did not violate inmates' constitutional rights in restricting prisoners in different institutions on writing to each other.

Justice Sandra Day O'Connor, writing for the court in Turner v. Safely, was joined by Chief Justice William H. Rehnquist and White, Powell and Scalia in deciding that the restrictions did not hinder First Amendment rights.

The court was unanimous, however, in concluding that Missouri regulations unconstitutionally restricted inmates' rights to marry by allowing such marriages only when wardens agree that there are "compelling reasons" to approve the marriage, such as a pregnancy.