THE AGREEMENT by nationalist guerrillas to a Western plan for Namibian independence is the best thing that's hit southern Africa in years. South Africa, the reigning colonial power for 58 years, had already accepted the Western plan for a United Nations-supervised transitionto independence this year. The guerrilla organization called SWAPO backed and filled, but now it has come along, too. Putting the plan into effect will be a tortuous exercise, but success does finally seem within reach.

How did this near-miracle of accommodation between South Africa and SWAPO, long at each other's throats, come about? One can guess that South Africa wanted to rid itself of a running sore and to do so in a way that would leave its Namibian friends (white and black) reasonably well off and earn it some credit in Africa and in the West for its moderation. SWAPO perhaps decided that it stood to gain more by compromising than by staying outside and giving its black political rivals inside a chance to consolidate their advantage.

SWAPO, we gather, was heavily influenced by Angola, Namibia's northern neighbor and the guerrillas' sanctuary. The Angolans, in urging SWAPO to go home and take their political chances, evidently had in mind to end South Africa's punishing anti-guerrilla reprisals into Angola and to end as well South Africa's support of Angolan insurgents.

The plan for Namibia was drawn by five members of the U.N. Security Council (the United States, Britain, France, Germany and Canada). They sagely took the play away from the General Assembly, whose automatic Third World-communist majority tends to unsuit it for serious political work. Within the "gang of five" the United States took the lead, and within the American government. U.N. Ambassador Andrew Young provided the inspiration and his deputy, Donald McHenry, did the heavy negotiating.

We say this not out of excessive pride but by way of noting that American diplomacy, which needed badly to win one somewhere, seems to have won one in Namibia. This is not a bad week, moreover, for the diplomatic talents of Andrew Young to bear fruit. He has been criticized, here and elsewhere, for some of his pronouncements. But it was his strategy of enlisting the "front-line" African states to deal with the guerrillas, while the Western states worked on South Africa, that produced the Namibian breakthrough.

The question of the hour is whether the Namibian example of Western-sponsored political and racial accommodation, freezing out open communist intervention, is relevant to the struggle in Rhodesia. The differences are substantial, and no one can be sanguine. We would underline, however, what seems to have been one of the chief elements visible in Namibia. The United States and its allies not only offered an agreement whose terms were acceptable, given the alternatives, to both sides. In its manner of diplomacy it approached both sides without giving either of them a basis for serious complaint about American fairness.

It is precisely the perception that in its manner, if not its terms, the United States has favored one side (the Patriotic Front) against the other in the Rhodesian conflict that has stirred the increasing congressional concern with administration policy in Rhodesia. The Namibian settlement, as a demonstration of American diplomatic competence, will help the administration deflect some congressional pressures on Rhodesia. To improve its chances of diplomatic success there, however, the administration will have to convince its critics - and the parties - that American policy does justice to both sides.