WHY IS PERU returning to democracy while, at the same time, its look-alike neighbor Bolivia is reverting to dictatorship? The long answer, a sad one, is that where the institutions that sustain democracy are weak -- such as independent political parties and labor unions and press -- it can go either way. In the dozen-plus years of recent military rule in Peru and Bolivia, some older citizens have gotten out of the democratic habit; the many young citizens who have come of age never got into it. It took the Carter administration's urgent pushing to boost Peru back over the sill, but now the elected government must deal with an economic crush and an impatient electorate. Cross your fingers. The administration pushed Bolivia no less urgently but failed.

There is also a short explanation, even sadder, of the differing fortunes of Peru and Bolivia: cocaine. Cocaine, marketed chiefly in the United States, has become Bolivia's largest export earner. Peasants can make more money growing cocoa leaves than coffee beans. The product fits well into an economy already well turned to the ways of contraband. Generals are among the country's leading drug dealers. The military said that the man who was about to take office as the elected president, Hernan Siles Zuazo, was a dangerous Communist. The coup-makers' acceptance of assistance from Argentina and their barbaric treatment of democratic leaders do suggest an ideological rationale. But the military's greater anxiety appears to be that Mr. Siles would crack down on the drug trade.Some coups are reprehensible. This one is vile.

It is a jittery time in the hemisphere. In Central America and the Caribbean basin, many governments are tending to the extreme left or right and the reformist democratic center is shrinking. The terms are different in South America proper: not so much left-right, as democracy-dictatorship. Far and away the most postive political development there in recent years has been the spread of democracy among the so-called Andean Group, including Venezuela, Colombia, Ecuador, Peru and Bolivia. They have been bolstered by each other and by foreign democratic socialists and Christian Democrats. But if any one of them falters, the others are affected in their separate ways.

The dispute in the United States over the Carter administration's human rights policy has obscured something importants about democracy in struggling countries. It's not just the frill -- the chrome -- on development. It's the shock absorber. It offers a process of consent and accommodation -- and dignity -- to societies undergoing racking change. The change will come anyway. Democratic government can cushion the blow.