A NASTASIO SOMOZA'S flight transforms Nicaragua's quest for a modern life. With him and the high command of his National Guard gone, it should be possible - if the initial turbulence can be claimed - to close a war that has taken perhaps 15,000 lives plus a grievous economic toll. That will be a true deliverance. But among the victors, a struggle for power - with luck, just a political struggle - is unavoidable. The five original members of the junta chosen by the Sandinista guerillas have the upper hand, but there are 18 others in the junta, added to broaden and moderate it at the urging of the United States and other Latin countries. The junta itself contains democratic socialists and Cuban-oriented radicals. The immediate definitive issue will be how to turn the Sandinistas, and perhaps some units or members of the Guard, into a national army. Will the Sandinistas, especially the radicals, surrender their sword to a political body they are not sure they will continue to control?

The United States waited too long - until the moderates had been virtually decimated - to get cracking diplomatically on the Nicaraguan succession. Now it is playing catch-up, hoping to gain Nicaraguan and other Latin acceptance of a democratic process before any Sandinistas who may be so minded manage to preempt it. Notwithstanding the assurances of democracy and justice offered by the Sandinista five, the effor is a long shot. It needs broad Latin cosponsorship to have a prayer. It also requires flexibility on the part of American diplomats, who must support not only among non-Sandinista Nicaraguans but alos within the ranks of the Sandinistas. It is only prudent to expect that Cuba will do what it can to help its clients and sympathizers among the Sandinistas. This poses extraordinary continuing requirements on inter-American diplomacy.

One does not have to be the president to hope that Jimmy Carter avoids the campaign challenge, "Who lost Nicaragua?" For now, at least, the question is premature if not misleading. The better question is: Once the Carter administration had decided to end the United States' four-decade embrace of the Somozas, could it have done more to help spare Nicaragua the convulsions it finally underwent and the uncertainties it faces now? Without a local democratic tradition or process, the best transition from dictatorship is bound to be tumultuous. But with timely and imaginative diplomacy aimed at setting up representative rule, the costs and risks can perhaps be eased.

In Nicaragua, the United States and the interested Latins lagged. With respect to El Salvador, Guatemala and Honduras - all corrupt, repressive regimes ready to pop - the truth is this: They cannot afford to lag now. Nicaragua is in mid-passage. The others are virtually sure to fall into similar crisis. This is no time for the friends of Latin democracy and stability to relax. It is a time to pitch in and work harder.