In a victory for labor, the Supreme Court ruled 6 to 3 yesterday that federal courts cannot block workers from staging politically motivated work stoppages, such as the dockworkers' refusal to handle Soviet ship cargo to protest the Soviet invasion of Afghanistan.

Even when unions have absolutely promised employers not to engage in any sort of strike, such "political boycotts" are covered by a federal law that prohibits judges from barring strikes or work stoppages stemming from a "labor dispute," Justice Thurgood Marshall wrote for the majority.

Unions conducting political boycotts, however, are still subject to multimillion-dollar damage suits by employers that lose money as a result of the work stoppage, under a Supreme Court ruling in April also involving the action by the dockworkers.

Chief Justice Warren E. Burger, dissenting, argued that the case, Jacksonville Bulk Terminals, Inc. vs. International Longshoremen's Association, "in no sense involves or grows out of a labor dispute." Instead, Burger said, "the dispute in this case is a political dispute and has no relation to any controversy concerning terms or conditions of employment."

Burger, joined by Justice Lewis F. Powell Jr., said that "there is no rational way to reconcile" yesterday's decision with the court's April ruling that the boycotts can subject unions to damage suits.

Justice John Paul Stevens filed a separate dissent.

Yesterday's case arose in January, 1980, when a local of the International Longshoremen's Association refused to load chemicals onto ships bound for the Soviet Union in accordance with an ILA resolution not to handle any Soviet cargo.

The operator of the shipping terminal and manufacturer of the cargo then asked a federal court to enjoin the boycott while the dispute was arbitrated, as required under the union contract.