The Soviet Union today vetoed a U.N. resolution calling for the withdrawal of all foreign troops from Cambodia, thus ending the emergency Security Council session on the Vietnamese and insurgent invasion of Cambodia.

Although the compromise resolution was vetoed, as predicted, opponents of the Vietnamese military action said the four-day debate "at least showed the Vietnamese they will have to pay a price for what they have done," said a Western diplomat. The vote was 13-2 in favor of the resolution, with Czechoslovakia joining the Soviets in opposition.

Japan and the Scandinavian nations have hinted privately that they are considering a halt in aid to Vietnam as a protest against the invasion that toppled the Cambodian Communist government on Jan. 7.

Vietnam, which once enjoyed widespread support here, was backed only by the Soviet Union, Cuba and some other Soviet-bloc nations during the debate. All the other nations that spoke, whether African, Asian, Latin American or Western, protested the Vietnamese-led invasion even though many also condemned as inhuman the policies of the ousted Cambodian Communist government.

It fell to Prince Norodom Sihanouk, former head of state of Cambodia, to argue for Cambodia at the U.N. debate even though he was only released from house imprisonment by the Pol Pot government two weeks ago. he was absent today after being hospitalized yesterday following what sources describe as extreme fatigue and the effects of stress.

This was first time that the Soviet Union and China were antagonists in a Security Council debate over a communist country. The United States kept on the sidelines, allowing the communist world to argue over who is trying to establish "hegemony" in Southeast Asia.

"It's comfortable for a change not to be hit over the head by the Third World," said one member of the U.S. delegation today.

The insults exchanged among the communist nations -- Vietnam, Cuba and Cambodia as well as the Soviet Union and China -- were so fierce that at the Friday session the Kuwait ambassador asked Sihanouk to end a particularly bitter argument with Cuba.

Cuba and Vietnam, not Council members, were invited to join the debate.

As U.S. Ambassador Andrew Young said on Saturday, the Cambodian-Vietnamese conflict raised a "cloud of confusion" because the Pol Pot government has been charged by the U.N. Commission on Human Rights with extreme violations, such as summary executions and deaths from malnutrition and disease.

Finally, however, all notions but those from the Soviet Bloc agreed with the statement made by an Australian: "We cannot accept that the internal policies of any government, no matter how reprehensible, could justify a military attack on it by another government."