The Supreme Court ruled yesterday that the U.S. military may give preference to foreigners in hiring at overseas bases without violating anti-discrimination laws.

The unanimous decision is significant for Americans living abroad, particularly for dependents of low-paid American soldiers whose spouses seek jobs on the bases.

They now may be denied work in favor of hiring nationals of the host country.

It also was a relief to the U.S. government, which feared that an opposite decision could disrupt relations with countries which agree to host military bases in return for hiring preferences.

Such a preference, incorporated in an agreement between the United States and the Philippines, gave rise to yesterday's case.

Anthony Rossi, a Vietnam veteran who remained in Asia after marrying a Philippine citizen, was replaced by a Filipino as manager of a U.S. Navy gaming room at the Subic Bay base.

Rossi, and others who were replaced, sued the government, charging that the preference violated a 1971 law prohibiting discrimination against Americans by overseas military installations. The law, however, said the discrimination was permissible if done as part of a treaty between the United States and a foreign country.

The question for the court was whether the U.S.-Philippines base agreement--and a number of similar agreements with other countries--was a treaty.

Justice William Rehnquist, writing for the court, acknowledged that the agreements, unlike treaties, do not have to be approved by the Senate.

But he said that the history of the law as well as traditions of international relations suggested that in this instance such "executive agreements" should be considered treaties for purposes of U.S. law.

The anti-discrimination law enacted by congress in 1971, he said, was concerned with "ad hoc decision making of military commanders overseas," not with formal base agreements between nations.

The court reversed a ruling by the U.S. Court of Appeals for the District of Columbia.

According to court documents, the United States has similar employment preference treaties with Iceland, the Bahamas, the Netherlands, the West Indes, the United Kingdom, Thailand, Taiwan, Australia, Spain, Antigua, the Seychelles and Turkey.