IN A PERFECT world, the United Nations would have snapped into action in the dispute between Britain and Argentina: a seemingly perfect case--slow- moving, legalistic, involving two reasonably friendly countries at a safe geographical remove--for international mediation. There was, however, no international machinery ready, and the United States, the country best placed to command a respectful hearing in both Buenos Aires and London, has filled the breach. There will be no small cost if the secretary of state's shuttle fails. To let two friendly states drift toward confrontation, however, would have been a disservice to them and to American interests alike.

Two friendly states: the president has been criticized for declaring, "We're friends of both sides," as though he saw no difference between the democratic ways and, in this dispute, Britain's status as victim and Argentina's authoritarian ways and its status as violator. But he simply reflected the truth that Washington is in a position to mediate. Was it, then, necessary for his ambassador to the United Nations to attend an Argentine Embassy dinner in her honor on the very night of the invasion? Of course not.

The purpose of Mr. Haig's shuttle is to bring about a peaceful solution of a dispute provoked by what the administration calls, not aggression, but "an armed military action of which we disapproved." He will presumably be trying to do this in a manner respecting two principles, both violated by Argentina: 1) territory is not to be acquired by force; 2) the wishes of people living on that territory cannot be ignored.

Behind the diplomatic problem is a political problem. In a real sense, Mr. Haig's mission has made him the custodian of two governments, Prime Minister Thatcher's and President Galtieri's. How can they both survive a settlement? Yet Mr. Haig can hardly appeal for the cooperation of either if it believes that the price will be its fall from power. There is something galling here, for Mrs. Thatcher's government, being elected, is unquestionably better. President Galtieri's represents a military establishment which, partly to work off the curse of its appalling human rights record, has been cultivating the administration by backing its policy in Central America--and, implicitly, by threatening to collapse and usher in a leftist-Peronist horror.

There is a purpose, however, to working with governments as they are. In this case, it is to resolve a nasty dispute that threatens to get badly out of hand. That is where Mr. Haig's focus must be.