During the recent Iran-contra hearings, we were warned repeatedly about the dangers of a clumsy Congress meddling in foreign policy. But the visit of President Oscar Arias of Costa Rica and the talk of peace in Central America strongly indicate that House Speaker Jim Wright's "micromanagement" was all to the good.

Wright's predecessor, Thomas P. (Tip) O'Neill Jr., was anti-contra to the bone. "A captive of the Maryknolls," exasperated State Department critics called him. Liberals thought the Texan was less committed, and when, in August, he joined the president in what his colleagues thought was the ritual administration pre-contra-vote peace offensive, they were horrified.

It was a roll of the dice, Wright admitted to them in a series of agitated meetings. But it was the last best chance they had before the administration took another step toward endless war in Nicaragua.

Wright did more than hope he was right. He sent his own man down to the five-nation parley of Central American presidents in Guatemala City. Miraculously, they came up with a plan. Arias called Wright in the middle of the night to give him the glad news. Two days later, the speaker endorsed it.

The White House, thoroughly aroused to the daunting possibility that a peace not of its making might indeed be at hand, started dumping on the Arias document. Philip Habib, the State Department's most seasoned trouble-shooter, suddenly quit -- forced out, it was said, by a realization that his negotiating skills with the Sandinistas would not be needed.

Wright soldiered on, through the president's designation of the Arias plan as "fatally flawed," through Secretary of State George P. Shultz's jolting request for $270 million more in contra aid. He talked to Central American ambassadors. He negotiated with Shultz and White House chief of staff Howard H. Baker Jr. Elliott Abrams, the State Department's most fanatical contra-promoter, was not at the table.

Wright boldly invited Arias to come to Congress and explain his plan.

The White House fretted and fumed about Wright's effrontery in bidding a leader to address the Congress -- that is a presidential prerogative. Wright paid a call on House Minority Leader Robert H. Michel (R-Ill.) to ask him to round up Republicans for what had to be called an "informal" session. He importuned Senate Majority Leader Robert C. Byrd (D-W.Va.) to bring a respectable representation from the Senate.

At the 11th hour, the White House felt compelled to ask Arias to drop by on his way to Capitol Hill.

Arias is short, with satiny black hair. He looks a little like Massachusetts Gov. Michael S. Dukakis. He walked into the chamber to bravos.

He made what one Republican conservative disdainfully called "a neutralist, pacifist speech," ending with the '60s slogan, "Give peace a chance."

The Democrats applauded more passionately than the Republicans. But all the members seemed glad he was there, acting as a buffer between them and an implacable president on a pesky and dangerous issue. Arias is the leader of an impeccably democratic country. If he thinks the Nicaraguans can be housebroken, it's hard to argue. He would be the No. 1 domino if President Reagan is right about the Sandinistas' expansionist tendencies. He has not so much as a corporal's guard to repel them. He reminded the members that Nicaraguan President Daniel Ortega has been doing some sensible things lately.

The Democrats have become convinced that Wright had outfoxed the president. Rep. George Miller (D-Calif.), at a human-rights dinner the night before, praised Wright without reservation. He had called Reagan's bluff, had conferred "dignity and pride" on Latin leaders, making it possible for the five "to tell their people that they were the presidents of their countries -- not Elliott Abrams."

Wright, looking radiant, escorted his guest to a Capitol news conference. Asked about the resumption of contra aid, should the Sandinistas cheat, Arias urged looking on the bright side.

Then a considerable contingent of doubters trooped over to the Cannon House Office Building for a question-and-answer session with the peacemaker. The news media were thrown out. It was too bad, because by all accounts, Arias turned specific, hard-nosed, resolute.

He made an astonishing conversion. Republican Rep. Newt Gingrich, of Georgia and the hard right, came out saying, "Arias frankly won me over."

Gingrich hated the Arias speech but loved his promise that if the Sandinistas fail to come across, "he will lead in denouncing and isolating them politically and economically."

Wright's timing was good. The momentum is on. The timing is right. "Micromanager" Wright is taking bows.