The year-end reprises found much in 1987 to bemoan: the trauma of the Iran-contra hearings, Black Monday, the sinking dollar, ballooning trade deficits, the budget crunch, Congress and the executive branch working at crippling cross-purposes. Mikhail Gorbachev seemed to be striding tall across the world stage; Ronald Reagan, a lame duck to begin with, looked scarcely ambulatory.

So the somber wisdom went that the United States, with a sorely weakened president, is going to be in the poorest possible shape to tend to paramount national security interests in a perilous world -- the more so in the political paralysis of an election year.

Well, maybe. It is certainly unsettling when so stalwart a supporter of Ronald Reagan as columnist William F. Buckley Jr. is saying in his year-end summing up that ''any way you look at it, our foreign policy is a mess.''

But look at it this way: any year that sees the public unmasking of Oliver North and John Poindexter and the congressional exposure of a secret government within the government accountable not even to the president can't be all bad.

The same may be said in gentler tones for a year that marks the retirement from influential offices of Donald Regan, Caspar Weinberger, Richard Perle, John Lehman and Pat Buchanan. Those departures brought a shift of the administration's center of gravity closer to the ideological center, where the heavy lifting is done.

The point, then, is that when this notion of a ''weakened'' president is advanced, you have to ask: Compared to what? And also: ''Weakened'' in what respect insofar as U.S. interests and national security are concerned? Historian Arthur Schlesinger Jr. shook up a panel on the MacNeil/Lehrer Newshour by advancing the argument that we shouldn't want ''a strong president if a strong president is going to do foolish things.'' Columnist David S. Broder found the idea ''mind boggling'' that the country is not badly served by "weakening the president."

They're both right; what skews the argument is the word ''weakened.'' The issue is whether we are better or worse off heading into 1988 than a year ago. By that test, the president has been not so much weakened as usefully chastened or maybe even reinforced by 1987's shocks and upheavals. With foreign policy properly lodged primarily with Secretary of State George Shultz, with Frank Carlucci at Defense, with law and order restored to the National Security Council staff, it can even be said that the president, to paraphrase Hemingway, is stronger at the broken places.

That doesn't mean that this shapes up as a banner year for U.S. leadership -- the last year of an outgoing president rarely does. It does mean that the new year could be safer and more productive than we would have had any right to expect if the dark side of the Reagan administration's conduct of international affairs had not been brought to light.

Leave aside an unforeseeable Crisis X that might put even a sobered Reagan administration to more of a test than it is up to (a collapse of the fragile Philippine democracy, perhaps, or a serious Iranian challenge to the U.S. escort armada in the Persian Gulf). There remains the prospect of some equally imaginable turns of events of a far happier sort.

For their own reasons (having nothing to do with exploiting perceived U.S. weakness), the Soviets might make the concessions necessary to extricate themselves from Afghanistan. There is evidence, however inconclusive, that the Soviets might have their own reason, as well, to pound enough sense into their Sandinista clients to keep the peace process alive. That might defuse what otherwise promises to be a brutal battle next month over renewing military aid for the contra resistance forces.

Finally, there is Ronald Reagan's deep commitment to ratification of his treaty on intermediate-range nuclear missiles. He has high hopes, as well, of moving on to a treaty on longer range strategic nuclear weapons in time for a June summit. Curiously, Buckley sees this as part of the foreign policy ''mess'': that a Republican president's disarmament policy should depend heavily on the favor of Democrats and that the floor fight for Senate consent to INF should be led by a Democrat, Alan Cranston, with whom ''it is safe to say {the president} . . . has just about nothing in common.''

That's not a very nice way to talk about California, whose enlightened electorate saw fit to vote for Reagan for president and Cranston for senator. That the two should see eye-to-eye on INF is not a symbol of the ''mess'' we've gotten into in foreign policy. It's a symbol of the only sensible, civilized way to get out of it.

Indeed, not the least of useful tasks remaining to a lame-duck president in 1988 would be the contribution Reagan could make to constructive, nonpartisan debate -- in the campaign as well as in Congress -- on arms control and on wider national security issues.

When Ronald Reagan's one-time, true-blue believers are keening for the resurrection of the old Reagan they loved and thought they knew, the ''new'' Reagan must be doing something right -- and filling them with awful forebodings that he will do more.