When historians assess the decline and fall of President Reagan's credibility, they are likely to find that the Iran-contra affair was a disaster rooted in obsessive presidential preoccupation with secrecy.

Reagan brought with him into the White House a mistrust of the news media that had many sources. He resented Hollywood coverage of the breakup of his first marriage and believed that Republican presidential candidate Barry Goldwater had been unfairly treated by the media.

The president also shared the view, expressed by Lt. Col. Oliver L. North during his six days of winning the hearts and minds of Americans on national television, that the Vietnam war had been lost on the home front, largely because of uncensored reporting. Reagan's view of the proper wartime role of the news media was formed during World War II, when "loose lips sank ships" and the press accepted censorship.

Once in the White House, Reagan cheapened the currency of national security by failing to distinguish between leaks of national secrets and leaks of politically embarrassing information. He was rarely outraged at scandals within his administration, but invariably angry at news accounts of the scandals. While Reagan would defend any aide against a charge of misconduct, he regarded leaks of even innocuous information as grounds for dismissal. Aides fought policy battles in the mass media and blamed one another for the leaks.

Reagan's basic view was that anything that happened behind the closed doors of the White House was his business. After White House aides had maneuvered Secretary of State Alexander M. Haig Jr. into resigning, Reagan was asked at a June 30, 1982, news conference what had happened. "If I thought that there was something involved in this that the American people needed to know with regard to their own welfare, then I would be frank with the American people and tell them," he replied.

The president never did tell the inside story of the Haig affair. His passion for secrecy grew, encouraged by aides who trusted Congress as little as they did the news media. The circles within the White House became tighter, restricted to those who supposedly had a "need to know." When the Iran initiative developed, Reagan did not consult experts who might have ridiculed the notion that "Iranian moderates" were functioning within the government of Ayatollah Ruhollah Khomeini.

The web of secrecy also cut Reagan off from political advice. Treasury Secretary James A. Baker III, a National Security Council member valued for his political skill, deliberately was kept out of the loop. So were political advisers who had ably served Reagan. "There was no one in there to say we can't swap arms to Iran for hostages after what we did to Jimmy Carter on this issue," said a longtime Reagan friend.

In the second term, as the administration stepped up covert activities in Nicaragua and turned to military action in Libya, a wartime mentality prevailed. It was a mindset expressed in an egregiously inaccurate story North told during the hearings about two members of Congress who supposedly informed reporters of the imminent U.S. air raid on Libya after being briefed by the president on April 14, 1986. North implied that this warning cost the lives of two U.S. airmen shot down during the raid.

Reagan enjoys bizarre stories of this kind, but North's account bears no resemblance to the facts. The two lawmakers -- Sens. Robert C. Byrd (D-W.Va.) and Claiborne Pell (D-R.I.) -- avoided waiting microphones on the White House driveway and returned to Capitol Hill after the briefing. Byrd said nothing, and Pell merely told reporters that Reagan would have a presidential announcement that evening without mentioning the subject.

As Sen. Daniel K. Inouye (D-Hawaii) pointed out in rebuking North for his account, the Libyan bombing had been widely signaled in advance. The news accounts appeared before Congress had been briefed and clearly were the product of administration sources.

The president and the country would have been better served if some of these same sources had blown the whistle on the arms-for-hostages deal. Instead, the administration succeeded in keeping the swap hidden from the American news media and the American people for 18 months. It was a costly triumph.

Reaganism of the Week: Asked by a reporter last Tuesday how he would appeal for more funds for the Nicaraguan contras, the president said: "Stand up on the roof and yell."