FROM the dismal story unfolding of administration ineptitude and wrongdoing over Iran, there is a lesson of moment to be learned. It was not an evil motivation on the part of the Reagan administration to want to identify and nurture elements in Iran that might one day replace its present narrow and hate-filled regime.
It is not wrong, either, to want to see tempered the authoritarian regime in Nicaragua that has stolen the revolution that once offered hope of democracy to that beleaguered little country.
But to spread democracy abroad, the United States must cherish and protect democracy and the rule of law at home.
That is the lesson the President's men forgot, and in their forgetfulness they did their President and their country a grave disservice.
In the wake of the departure from the National Security Council staff of Vice-Adm. John Poindexter and Lt. Col. Oliver North, many who knew them were quick to speak of them as decent men, patriots, intent on serving their nation.
But a worthy end does not justify unworthy means. Patriotism is sullied when overtaken by arrogance and self-will. Dedication to democracy becomes hypocritically hollow when cloaked in deception and dishonesty.
And so a little clique - we do not yet know how many - did great damage by subverting at least the spirit, if not the letter, of the law, strongheadedly mounting an operation they believed to be right, but which was in fact unwise and perhaps illegal.
What impelled them to such arrogance? Was it the extraordinary popularity of their President, the successes of his administration, that gave them the heady feeling that they could do no wrong?
Was it the decentralization of management in the Reagan administration that they thought gave them loose enough rein to conduct their own foreign policy?
And if the National Security Council staff was carrying out its own foreign policy, where were the other voices that might have warned the President that his willful White House aides were taking him down a road to disaster?
An angered President Reagan has appointed an inquiry into this. It should dig deeply and get the whole story out.
The administration is to be commended for going public fast with the story of diverted funds to the contras. Ronald Reagan is not Richard Nixon, and the Iran debacle need not become his Watergate.
We have had enough broken presidencies for a while. It would be tragic if a President whose overriding quality - whether or not one agrees with his policies - has been strength of leadership should be hobbled and made ineffective for the next two years.
Mr. Reagan must discipline his National Security Council staff and return them to a role of coordination and planning. They must cut out the cowboy stuff. A start has been made.
The decisionmaking process should probably be pondered and perhaps refined.
Strong and powerful men have left major jobs outside government to serve in this administration, and their views need to be taken into account, not sidetracked.
But once the President has listened to them, been presented with the options clearly, and made his decision, there ought to be one foreign policy, not several, depending on whom in the government you talk to.
There can be an inquiry, and a wise men's group, and perhaps some tinkering with the structure of the decisionmaking process, and perhaps some more staff changes. This may help with the mechanics.
Meanwhile, as has been proved again, Americans have a complex, but effective, system of checks and balances that catches out those who would shortchange democracy at home.
The other important needed ingredient is presidential leadership. President Reagan says he was not aware of the wrongdoing that was going on. If he was personally uninvolved, he was nevertheless presiding over an administration out of control.
The need is for him to regain control, and to assert the leadership that has been his hallmark.