Not long ago the State Department delivered to the embassy of Nicaragua in Washington a message actually intended for the embassy of Nigeria. A simple mistake by the messenger, you say? Come explore the Sandinista mind. The Nicaraguan ambassador, a former academic and no roughneck, sent back a note chiding the State Department for the error.

This little tale was related to me last week by the ambassador, Carlos Tunnermann. He went on to muse on whether the State Department, in recently making a Central America hand named William Walker its key regional officer, had intended to prick Nicaragua with the memory of the American mercenary William Walker, who made himself president in 1855. The ambassador didn't think it was deliberate (upon checking, I found the idea was as peposterous as it sounds), but he allowed that others in Managua weren't so sure.

I pass on these bits because they anticipated so precisely the chip-on-the- shoulder edginess, suspicion and doggedness that colored Sandinista conduct in Panama over the weekend. There the eight countries of the Contadora group made a desperate final effort to paste up a Latin diplomatic alternative to resumption of American military aid to the contras.

The eight arrived in Panama with what seemed a sensible idea. Publicly, the eight swear up and down that they oppose contra aid. Privately, they were poised to make a discreet use of the threat of it: they meant to seize the moment when Congress was in mid-passage to urge Managua to make some moves that would head off the aid -- moves that could plausibly be presented as elements of a cooperative Latin initiative and not as con- cessions made under American pressure.

The Sandinistas, however, simply refused t accommodate their fellow Latins and to take the steps that offered at least a possibility of slowing the Reagan express. Their foreign minister pumped out in private the kind of superheated revolutionary defiance that Daniel Ortega, president of Nicaragua, pumps out in public. The eight were reminded that the United States is 1,000 times as big as Nicaragua, that Reagan wants to crush the revolution, and so forth. The conference collapsed.

It's a pity. I suspect the Contadora initiative could work, in Latin terms, if the United States supported it. Support, let us be clear, means not simply issuing statements of support but ending contra aid. In those conditions, Contadora might accomplish the Latin priority of closing out the Nicaraguan civil war and preempting possible American intervention.

Reagan, of course, regards this result, if that's all there is, as unacceptable and dishonorable. For Contadora, Latin style, would leave the Sandinista regime in power. His priority of installing democracy in Managua would then have to be served by collective hemispheric pressure short of military action and by time and hope. These are, necessarily, weak and uncertain means.

Still, had the Sandinistas softened their line at the Panama meeting, they could have given the sort of ammunition to Reagan's congressional challengers that might have bought some time on aid. Instead, the Sandinistas hardened their line, rejecting even steps that would have cost them nothing -- opening a new dialogue with the internal opposition. Their delegation said it was not enough for Washington to cut off the contras: the American attitude toward the revolution would have to change.

Not many Latins attribute Sandinista rigidity to stupidity, as do some Americans, applying their own sim- plistic standards of cost-benefit pol- icy analysis. The truer explanations go to what it takes to conduct a revolution, especially a communist revolution.

It takes a faith that the future will unfold according to a plan that everyone around you thinks is impossible. One can argue whether this is the definition of realism or romanticism, but it breeds tremendous arrogance, which success makes greater.

The Sandinistas are in a state of high excitement merging fear and triumph. Even as they contemplate their martyrdom in a coming American onslaught, they pulse with the thought of having seized their destiny, resisted the great colossus of the North and, not least, embarked on a historic social transformation. These are the elements of the revolution that allow the Sandinistas to mobilize some considerable part of the Nicaraguan citizenry, and to practice moral intimidation upon other Latins in turn.

A Latin president who met the Sandinista vice president, Sergio Ramirez, observed to him that if Nicaragua had become a "second Sweden" or a "second Costa Rica" -- socialist but democratic -- it would be everybody's favorite. But the Sandinistas are revolutionaries, Ramirez replied. We Americans are having to learn that lesson, again.