The United States won a bare majority in the Security Council tonight for a resolution deploring the destruction of a South Korean airliner by Soviet warplanes, but a Soviet veto defeated the measure.

The vote was 9 to 2, with four abstentions. The United States won support from five Third World nations--Pakistan, Jordan, Malta, Zaire and Togo--as well as its western allies, Britain, France and the Netherlands. Poland joined the Soviet Union in voting against the resolution, while Nicaragua, China, Guyana and Zimbabwe abstained.

The result of the U.N. debate fell somewhat short of the western hope of totally isolating the Soviet Union and its allies. In fact, it was only at the last minute that the Maltese switched from an abstention to a yes, providing the crucial ninth vote required under U.N. rules to force the Soviet veto.

But in the course of the week-long debate, more than 35 nations spoke out in condemnation of the Soviet action, while only three of Moscow's allies stood up to back its stand.

British Ambassador Sir John Thomson said afterward the veto was "a somber memo," demonstrating that "the Soviet Union is impervious to international opinion."

By barring a U.N. investigation of the shooting down of the airliner, as called for in the resolution, Thomson said, "The Soviet Union has shown that its main concern is to suppress the true facts."

The U.S. ambassador, Jeane J. Kirkpatrick, denounced the Soviet Union for insisting on a different standard of law for itself, and thus damaging the fabric of international relations.

The Maltese delegate, Victor Gauci, said his vote for the resolution had been conditioned on assurances by western nations that they would seek to enter negotiations with Moscow to explore the strengthening of safeguards for civilian aircraft, and both the British and the Americans promised to pursue this goal.

They called on Moscow to cooperate at a meeting of the International Civil Aviation Organization in Montreal later this week to work out practical measures that would prevent any similar disaster in future.

But both warned that the Soviet insistence that its actions were totally justified is unacceptable.

U.S. officials privately expressed their dismay that Guyana, China and Zimbabwe had refused to join the majority. They noted that Guyana abstained despite a personal appeal from British Prime Minister Margaret Thatcher to Guyanese Prime Minister Forbes Burnham.

And they expressed particular annoyance that Zimbabwe's abstention came as its prime minister, Robert Mugabe, was meeting with Secretary of State George P. Shultz in Washington to discuss U.S. aid, among other issues.

The resolution vetoed tonight, in addition to deploring the destruction of the airliner, would have declared that such use of armed force "is incompatible with the norms governing international behavior and elementary considerations of humanity." It would have recognized the right to compensation for the families of the 269 victims and urged the strengthening of safety rules for civil aviation.

The text had been modified to attract the maximum number of votes, and therefore contained no direct condemnation of the Soviet Union. In addition, it recognized the principle of "territorial integrity" of national borders.

The Soviet veto had been anticipated from the outset by the United States and the 16 other sponsors of the resolution.