WASHINGTON - In tough and spirited questioning, the Supreme Court justices yesterday delved into the Massachusetts Burma law and probed whether states have the right to set foreign policy - or the right to set any rules of trade on their own.

The explosive issue of states stepping into world affairs arose for the first time in the widespread South African divestiture movement during apartheid in the 1980s, but that matter never reached the Supreme Court.

The Massachusetts law is likely to establish whether states have the right to decide with whom they do business, an increasingly common question as global trading expands.

In 1996, Massachusetts essentially stopped doing business with companies that deal with Burma, also known as Myanmar, by putting them at a competitive disadvantage for state contracts. The law stemmed from outrage about human rights abuses by that country's military regime.

The case was one of the most eagerly awaited on this year's high court calendar, and many of the justices - some sitting at the edge of their seats - constantly interrupted the lawyers representing both sides.

While Massachusetts argued that states have a right to use their purchasing power to penalize a dictatorship, businesses and the US government say that amounts to unlawful interference in foreign policy.

Many US businesses have pulled out of Burma since the Massachusetts law went into effect, including Levi Strauss, Eastman Kodak, and Hewlett-Packard.

Some justices openly doubted the wisdom of states making financial decisions that affected US policy. Others wondered why the matter shouldn't be left to Congress.

Thomas A. Barnico, assistant attorney general for Massachusetts, argued that the state's action in passing the law would be the first of many because of the explosive growth of global trade.

But Justice David H. Souter wondered why states couldn't express their opposition to brutal regimes in a way that doesn't interfere with US policy.

''Massachusetts could pass a resolution condemning Burma, but it would be left to the United States to go beyond expression of issue and set regulations,'' said Souter, a former judge in New Hampshire. ''Wouldn't that be sensible?''

Barnico didn't think so. ''It leaves us open to giving support for these countries with our money,'' he said.

Souter responded that with a resolution, ''you could clear your conscience, and any fault would rest with the federal government.''

''I'm not sure it would clear our conscience,'' Barnico said.

Justice Anthony M. Kennedy asked whether the Massachusetts law could lead to states taking issue with other states over certain practices.

Barnico said he strongly doubted that outcome. ''We are acting against our own economic self-interests here,'' he said. ''Our principle will be limited.''

After Massachusetts passed its law four years ago, President Clinton signed an executive order in 1997 that slapped economic sanctions against Burma for its systematic human rights abuses. Four states and about 30 municipalities have passed similar Burma boycott laws.

Justice Ruth Bader Ginsburg asked: ''For Massachusetts to go on its own when the United States is saying we want to get together with world neighbors'' on a Burma policy, ''isn't there a clash?''

Solicitor General Seth Waxman said the Massachusetts law already has created problems for the US government and international trade relations.

''It has created considerable discomfort with trading partners and allies,'' Waxman told the justices. ''Instead of conversations with traders about what to do with Burma, our conversations now are what to do with Massachusetts.''

Timothy B. Dyk, the lawyer who argued the case for the National Foreign Trade Council, representing 600 companies, called the Massachusetts law a ''coercive'' attempt to block trade with Burma. Warning that other states and cities could enact similar laws, he urged the justices to ''take the teeth away from the dog.''

But Justice Antonin Scalia wondered why there was such a fuss over the law. If Congress objected, he said, why couldn't it pass a law against such trade restrictions? ''Isn't that enough to solve the problem?'' he said.

''No, it's not enough,'' Dyk said. ''Congress would be besieged.''

Justice John Paul Stevens asked whether states should be able to encourage certain kinds of trade. ''What about a disaster in another country?''

''It could do that,'' Dyk said. ''The question is, is it trying to influence the policy of a foreign country?''

Scalia then asked Dyk: Where does it say in the Constitution that a state can't engage in foreign policy?

Dyk listed several conditions, among them, that states cannot declare war and cannot violate existing treaties with other countries.

But Scalia's question hung, answered by the lack of an answer.

The court will decide on the case, Natsios v. National Foreign Trade Association, sometime before July. Two lower courts had struck down the Massachusetts law.

After the hearing, Dyk said the rapidly growing global economy is a key reason to put limits on states now.

With demonstrators shouting at him, ''No more dollars for dictators!'' Dyk said, ''As trade becomes more important, it becomes more important for Congress to speak with one voice.''

Moments later, the Massachusetts contigent was cheered by the crowd of about 100 people on the Supreme Court steps. One person held a placard that read, ''Boston Tea Party 2000.''