Sudden realization that CIA Director William J. Casey, Ronald Reagan's friend and campaign manager, could be run out of his job by the personal spite of an aging Republican patriot and lingering "old boy" animus at the Central Intelligence Agency belatedly spurred the Reagan posse to stop the lynching.

Not the burden of evidence but overt opposition from Sen. Barry Goldwater and covert sabotage from the gang at Langley had energized the Washington mob to string up Cassey. A July 24 phone call to the White House from Senate Majority Leader Howard Baker that things had gone far enough finally brought pleas of restmaint from the president.

No Senate colleague dares accuse Goldwater, 72-year-old chairman of the Senate Intelligence Committee and one of the nation's most beloved partisan warriors. Nevertheless, the fact is that Goldwater's startling press conference July 23, ostensibly called to show support for Casey, started the demands for his resignation.

Taking the lead, Goldwater invited Democrats to step up to the place and knock the stuffings out of Bill Casey. He also prepared Reagan's first major political embarrassment and set back the Cia's painful efforts to rehabilitate itself.

Goldwater's performance was rooted in his personal feeling that he knows more about the CIA than Casey will ever know. That feeling grew when Casey's choice of an inexperienced Max Hugel to run the agency's cloak-and-dagger operations blew up in Casey's face. It has been buttressed by frequent and expert testimony before the Intelligence Committee by Adm. Bobby Inman, deputy CIA director, contrasting favorably with Casey. Goldwater wants Inman to replace Casey.

Goldwater's activities on the Intelligence Committee have been on the baroque side. Last November, he "ordered" the secretary of the Senate to fire three Republican committee staffers who were asked to serve on Reagan's CIA transition team. Goldwater was taking the advice of his hand-picked committee aide, Earl Eisenhower, who incorrectly told him it was unconstitutional for legislative aides to work on a transition team. A few days later, all three aides were reinstated in their jobs, and Eisenhower was ousted.

Last week, in an equally curious decision, Goldwater told Republican committee members there was no money to hire a special counsel to handle the Casey affair. They talked him out of it; Fred Thompson, Republican counsel to the Senate Watergate Committee and the Haig confirmation hearing, was quickly hired.

Inside the badly wounded CIA, Casey's freewheeling operation -- especially hiring Hugel as spy master -- had agitated the "old boy" network. His efforts to breathe new life into agency, while applauded by many old hands, rubbed others the wrong way.

Casey has introduced what one intelligence expert calls "the merest whiff of competition" into CIA's analysis and assessments of worldwide intelligence. Even one "whiff" of outside competition is too much for some Langley veterans. They prefer to limit the vital estimates game to the agency itself without consulting outside experts as then-CIA Director George Bush did with the famed "Team B" in 1976.

Congressional insiders claim that word of a far-out "dirty tricks" operation, erroneously alleged to have been aimed at Libya's Muammar Qaddafi but resisted by the House Intelligence Committee may have been leaked from the CIA, not on Capitol Hill. That leak was clearly designed to damage Bill Casey, even through it was the ousted Hugel who secretly testified about the operation to the House committee.

When the authoritative voice of Barry Goldwater rang out to demand Casey's resignation, the White House was stunned. It took senior aides until the weekend to complete a full check of Casey's alleged financial problems, which turned up nothing new. In the interim, without proof of any kind, Sen. Ted Stevens of Alaska, the Republican Whip, imperiously declared it to be his "judgment" that Casey should take Goldwater's advice. Republican Sen. William Roth, seeking re-election in Delaware, echoed Stevens.

That was followed by Democratic Sens. Joe Biden of Delaware and Patrick Leahy of Vermont, both committee members, charging that the mere existence of allegations against Casey was demoralizing the CIA. "I hope he's not on the job Monday," Biden piously told The New York Times.

Belatedly aware that a Casey strikeout on foul balls is a real possibility, Reagan finally counterattacked in public early this week. Also needed is private word to Goldwater that Reagan will not allow any senator, however revered, to seize power over dismissal and appointment of the director of the CIA. That is the least the president owes Bill Casey -- and his country. c