THE SOVIET UNION and the United States took a step back from a diplomatic brink this week and settled the confrontation over Andrei Berezhkov. The 16-year-old son of a high-ranking Soviet diplomat had been secluded at his country's embassy for a week after letters, purportedly from him, had been received by the White House and The New York Times expressing a desire to remain in the United States.

Each side gave a little. The Soviets produced Andrei, who made a statement to the press and was questioned briefly. He looked like most Americans his age, right down to the jeans and sneakers, and he offered assurances--without much visible enthusiasm--that he wanted to return to Moscow and that he had not written the letters or asked for asylum. For its part, the American government accepted the boy's statement at face value and made no attempt to prevent his departure or to talk to him in private.

Legally, the State Department was on shaky ground to begin with. There was no immediate way of knowing whether the letters bearing Andrei's signature were forgeries. He had not sought sanctuary away from his parents and countrymen, or applied officially for political asylum. Of great importance, he is a minor and he had diplomatic immunity. It is not at all certain that American courts would or should have allowed his removal from parental custody under these circumstances.

Why, then, did the U.S. government put such pressure on the Russians to produce the boy? It is because most Americans have a traditional and profound respect for those seeking political asylum and a strong aversion to someone's being hijacked. The nation has probably not recovered from the sense of shame stirred when a Lithuanian seaman seeking asylum was returned to a Soviet ship against his will some years ago. No one wants that kind of thing to happen again, and there is a readiness to take extraordinary steps and even bluff a little to make sure that it doesn't.

After a week of stalemate, Soviet officials realized that Americans had to see Andrei, had to hear him say that he truly wanted to go home. Notwithstanding the government's legal position, it was important to ensure that this boy was not being shanghaied. Otherwise the political backlash and the resultant harm to Soviet-American relations could have been great.

We wish Andrei Berezhkov well. We don't know what awaits the teen-ager at home, but we hope he is treated with the tolerance, understanding and compassion that all 16-year-olds need and deserve.