William J. Casey has survived as CIA director, at least for the moment, but the wrong conclusions will probably be drawn from the Senate investigation of his activities and the pratfall from power of his spy-master, Max Hugel.

The moral of the story, some will assume, is that the CIA should be left to the professionals. That, of course, is precisely what the powerful network of Old Boys, both inside and outside the CIA, would like the public to think. The intelligence professionals, the career spies, prefer to regard "the agency" as their private preserve. Outsiders are poachers.

While the controversy may have appeared on the surface to be a struggle between the Senate intelligence committee and Casey, the real struggle was over who will control the CIA. Arrayed on one side were Casey and the president, who gingerly supported his CIA director. On the other side were the Old Boys, the present and former CIA professionals, and their allies on Capitol Hill.

It was an old battle played out again with a new cast of characters. Back in 1965, President Lyndon Johnson appointed Adm. William F. Raborn Jr., the man responsible for the development of the Polaris missile, as CIA chief. The Old Boys were annoyed. Within weeks, stories found their way into print reporting that at CIA meetings Raborn was a muddle of confusion, "so unlettered in international politics," as Newsweek put it, "that he could not pronounce or even remember the names of some foreign capitals and chiefs of state." Six months later, Raborn was out as CIA director. With the admiral piped ashore, Johnson named a professinal, Richard Helms, to the post.

Besides Raborn and Casey, at least two other outsiders who served as CIA directors were targeted by the professionals. President Nixon named James A. Shlesinger to the job in 1973. Schlesinger fired a number of Old Boys, arousing much ire within the agency. Under Jimmy Carter, Adm. Stansfield Turner managed to survive as CIA chief, but many old agency hands refer to him mockingly as "the Admiral."

The current flap had its unobtrusive beginnings late in March when Casey quietly moved John McMahon out as deputy directory for operations (the CIA's covert side) to head intelligence and analysis. Then, on May 11, Casey tapped Hugel, who had worked with him in the Reagan campaign, to be the DDO.

Only four days later, on May 15, Cord Meyer, the covert-operator-turned-columnist, surfaced Hugel's name, revealing the appointment of "a rank amateur" to head the agency's cloak-and-dagger directorate. The drama had begun.

Two brothers, former business associates of the Brooklyn-born Hugel, went to The Washington Post. On July 14, within hours of the newspaper's publication of charges of improper or illegal business activities by Hugel, he had resigned. There were those sho argued, albeit not seriously, that the dislosures only proved Hugel's superior qualifications for the job. According to the Hugel tapes and other revelations in The Post, the spymaster had threatened to kill a lawyer who got in his way, warned his business associate that he would hang him by the testicles and admitted (in his unpublished autobiography) that he was a liar, informer and a bunko artist. To top it all, he beat the CIA lie detector. What finer background could anyone have to head the CIA's dirty tricks division?

But Hugel went quickly down the tube. Perhaps, one anonymous White House official speculated, with some help from "former intelligence officials." Whether anyone, inside or outside the CIA greased the ways for Hugel's fall, remains, like so much about the agency, clouded in mists. But it is very clear that Casey's appointment of Hugel, a one-time sewing machine manufacturer, rankled the CIA professionals like nothin in recent memory.

From the tree-shaded lanes of Langley to the Federal-style homes of Georgetown, the sputtering could be heard wherever old spooks gathered. It was as though a busboy had suddenly been made a Member of the Club. Unheard of!

On the very day that Hugel resigned, stories mysteriously surfaced noting that a federal judge -- two months earlier on May 19 -- had ruled that Casey and others had "omitted and misrepresented facts" to investors in Multiponics, Inc., a company that owned farm acreage in the South. In succeeding days, Casey's image came to resemble nothing so much as a series of ducks in a carnival shooting gallery. One duck carried a sign reading "Multiponics." Others read "Vesco," "ITT," or had similar labels of cases in which the CIA director's name had figured in the past. No sooner would one duck be shot down than another would pop up.

Casey had concealed a $10,000 gift, said one story. Casey had links to a New Jersey garbage man who might have links to the Mafia, said another. Soon Barry Goldwater and other influential Republicans were calling for Casey's resignation. In the midst of it all, Samuel and Thomas MNell, Hugel's accusers, vanished.

The White House -- remembering President Carter's difficulties with Bert Lance -- gave Casey only lukewarm support, but the CIA director rallied his friends and supporters and had gained ground by the time the Senate committee held its one day of hearings into the affair on Wednesday and found Casey not "unfit" to serve. There was some feeling in Washington that Goldwater and other senators, in their earlier calls for Casey's resignation, had rushed to judgment. But Goldwater is clearly the CIA professional's favorite senator. "I don't even like to have an intelligence oversight committee," he said recently. "I don't think it's any of our business."

Complicating the struggle was the figure of Adm. Bobby Inman, Casey's deputy, who went on ABC's "Nightline" in a rare appearance to defend his chief and to deny that he, Inman, was "orchestrating" the scandal in order to succeed Casey. Inman, who was undoubtedly Goldwater's choice for the job of CIA director before it went to Casey, is an intelligence professional -- he formerly headed the National Security Agency -- who is often surprisingly outspoken.

"Clearly," he told Ted Koppel on ABC, "those inside the agency would prefer that all the promotions come from the inside."

As Inman suggests, the Old Boys would have us believe that covert operations and clandestine collection should be run by the professionals. The difficulty is that the CIA professionals are the same wonderful folks who brought us the Bay of Pigs. They also produced Operation CHAOS, the illegal spying on Americans who opposed the war in Vietnam, as well as MKULTRA, the drug-testing program in which yamericans were lured from bars by the CIA and given LSD without their knowledge, and HTLINGUAL, in which the agency steamed open hundreds of thousands of first-class letters in violation of federal law.

It was the professionals of the DDO who tried to kill Patrice Lumumba by poisoning his toothbrush, who wanted to make Castro's beard fall out by dusting his shoes with thallium salts, who tried to capture a crocodile and hire and African witch doctor to brew its gall bladder into a special poison, who attempted to use dogs as mind readers and cats as eavesdroppers. And who hired two Mafia thugs to put botulinum in Castro's food. (The CIA tested the poison on monkeys first. The monkeys died.)

Casey does seem in his checkered career to have walked very close to the edge of impropriety. An awful lot of people seem to have sued him over the years. And his appointment of Hugel, who was obviously modeled on Maxwell Smart, did show poor judgment. But, in principle, there is no reason why reputable outsiders should not be appointed to the top jobs at CIA. At the very least, they will save us from the professionals.