If the FBI 15 years ago had discovered the alleged Walker spy ring -- or the CIA secretary and her Ghanaian boyfriend charged as spies yesterday -- the arrests might never have been made, and the public never would have heard about the cases, intelligence specialists said.

In the Vietnam era of the late 1960s and early 1970s, the Justice Department almost completely stopped prosecuting American spies. Instead, officials would squeeze suspected spies out of their jobs quietly, seek to turn them into double agents or use them in other ways against their foreign controllers, the experts said. Some military spies in that period were court-martialed, with little fanfare, rather than tried in civilian courts.

From 1966 to 1975, the Justice Department obtained indictments against only two persons for espionage-related crimes, according to federal agencies' records, whereas from 1976 to the present, it has obtained indictments against 37 persons, not including yesterday's arrest of CIA employe Sharon M. Scranage and her boyfriend, Michael A. Soussoudis.

A decision in the middle 1970s to resume spy prosecutions, spearheaded by Attorney General Griffin B. Bell and continued by the Reagan administration, has helped cause a ballooning in spy prosecutions in recent years.

Leading up to the spy case announced by the FBI yesterday, there was discussion among federal officials about whether to prosecute Soussoudis, because he is a foreign national and it was thought that prosecution could anger Ghanaian officials, sources said. But government officials apparently decided to "take the diplomatic hits" and prosecute, a source said.

Federal prosecutors have a perfect record in espionage prosecutions, getting guilty pleas or convictions on all such cases since World War II, barring extraordinary cases, such as those in which defendants were found to be incompetent to stand trial or were swapped for other persons from the Communist bloc, Justice officials said.

Never before have so many persons been awaiting trial in the United States for espionage as there are now: 12.

Besides the four in the Walker spy case, among those awaiting trial is Richard Craig Smith, the former Army counterintelligence specialist who is charged with accepting $11,000 from the Soviets in exchange for the identities of six American double agents, supposed Soviet spies who were actually working for the United States.

Also awaiting trial is Richard W. Miller, the first FBI agent charged with espionage. Two weeks ago, two Soviet emigres, Svetlana and Nikolai Ogorodnikov, pleaded guilty to conspiring with Miller to pass secret documents to the Soviets.

Foreign diplomats cannot be prosecuted for spying because of diplomatic immunity, and it is difficult to know how many of them have been discovered spying because many such cases are handled quietly. Federal agencies, including the State Department and the FBI, said they do not have comparative annual statistics on the number of Soviet bloc diplomats declared persona non grata for espionage and kicked out of the United States. Few nondiplomatic Soviet bloc officials or other representatives were prosecuted on espionage-related charges in the 1960s, but a number of them have been indicted on such charges in the last 10 years.

An examination of the shifting politics of espionage prosecution -- based on interviews with former government officials and intelligence specialists and the memoirs of Bell and former CIA Director Stansfield Turner -- shows there is not always unanimity among policy-makers about prosecuting spies in criminal court.

Justice Department prosecutors often clash over spy prosecutions with representatives of the CIA and the Pentagon, who generally prefer to guard national secrets rather than risk exposing them in a public trial. In addition, intelligence officials often prefer leaving suspected spies in place to try to "double" them into spying for the United States, or otherwise help to disorient the opposing intelligence agency.

"It's an unending debate, and it's going on in every espionage case," said Kenneth Bass, the Justice Department's counsel for intelligence policy in the Carter administration. "Many intelligence people say, 'It's better to let (spies) stay in place. At least we know where they are.' Their view is that intelligence is like prostitution: It isn't going to go away because you prosecute."

While many intelligence officials believe that prosecuting spies is desirable because it serves to educate the public and act as a deterrent, others believe that prosecuting wastes opportunities to use spies to the advantage of the United States. Engaging unmasked spies in often complex counterintelligence operations is a valuable tactic that keeps foreign spy agencies on guard, former U.S. intelligence officials said.

In addition to "doubling," intelligence operatives can choose to leave the suspected spies in position and restrict information to them, or feed them false information that sheds doubt on what they had previously given their spy masters, intelligence experts said. These steps can be taken with or without the spies' knowledge, they said.

"You can't keep sending the Soviets false information for very long," a former counterintelligence official said. "It's very tricky, but you have to keep sending them something. What (the Soviets) are always evaluating is how valuable the material is that's been given to them. They always want to know the date we caught on."

There are many reasons the government withdrew from prosecution during the 1960s.

First, the Johnson and Nixon administrations sought to minimize public awareness of espionage activity, sometimes for diplomatic reasons, to avoid disrupting efforts to improve relations with the Soviet Union.

"Diplomats who were trying to search for peace with the Soviet Union would think that having trials and exposing Soviet penetration is not to their advantage," said Roy Godson, a Georgetown University government professor, intelligence specialist and government consultant. "It creates unpleasantness."

But the fact that there were so few espionage prosecutions in the Vietnam War era is not evidence that there were fewer spies then, intelligence specialists said.

In the spirit of cooperation with the Soviets, the U.S. government in the late 1960s started allowing more Soviet bloc officials into the United States. The number increased from fewer than 1,000 in the middle 1960s to more than 2,500 now. Up to 40 percent of them are believed to be intelligence agents. But the staffing levels of FBI, CIA and military counterintelligence did not keep pace with the increase, they said.

This imbalance has continued until today, the intelligence experts said, and FBI counterintelligence agents have had a difficult time keeping up with movements of Soviet intelligence agents here by surveillance and "tailing."

Some American spies who were reported to have started operating in the 1960s were not detected until years later.

Examples include the alleged Walker ring, which investigators say began as long as 20 years ago and was discovered only after a tip from relatives; and Joseph George Helmich, a former Army cryptographer who supplied the Soviets with top secret coding systems for $131,000 in 1963, but was not detected until 1980. Helmich was sentenced to life imprisonment after a guilty plea, but his disloyalty may have lost American lives in the Vietnam War, experts said.

CIA and FBI domestic surveillance -- including investigations of dissidents and mail-opening projects -- never did find the communist influence in the anti-Vietnam War movement that two presidents had suspected. But the domestic intelligence projects brought a civil liberties backlash starting in about 1974 that prompted a wave of distrust of counterintelligence, and forced retirement for many such as 20-year CIA counterintelligence chief James J. Angleton.

Prosecutors resumed their spy prosecutions in this atmosphere of reform -- and demoralization for counterintelligence operatives -- as the intelligence agencies were being reined by the White House and Justice Department. Among the first of the new spies targeted were two Californians in their twenties, Christopher Boyce and Andrew Daulton Lee, arrested in January 1977. They are serving prison terms for selling extraordinarily sensitive satellite information to the Soviets in Mexico City.

Bell was personally responsible, in part, for the policy of resuming espionage prosecutions and veering away from "intelligence games," the Justice Department's Bass said.

"Bell was willing, unlike some other attorneys general, to push this," Godson said. "And he got Carter and (National Security Affairs Assistant Zbigniew) Brzezinski on his side."

Bell wrote in his memoirs that several times his battles with the CIA and the Pentagon were so intense that Carter had to referee.

Bell was "continually at odds with the CIA, the National Security Agency . . . (and) all parts of the intelligence community" because of their desire to avoid compromising intelligence secrets in the courtroom, he wrote. "Life for our spies and counterspies would be easier if the attorney general kept his eyes and his mouth shut."

There was "considerable tension" between the Justice Department and the CIA over the prosecution of David Truong, a Vietnamese antiwar lobbyist and agent for the communist Vietnamese government, Turner wrote in his recently published memoirs.

Truong was receiving classified cables from an associate working for the U.S. government and sending them to Vietnamese officials in Paris.

Unfortunately for Truong, his courier, the Vietnamese-American wife of a Navy officer, also was a CIA informant.

The informant, Dung Krall, was frightened about her relatives in Vietnam, and CIA officials had promised that her identity would not be revealed and that she would not have to testify against Truong. Her father had been the North Vietnamese ambassador to Moscow, and Krall's information had been valuable to the CIA over the years. Bell recalled that a CIA officer met secretly with Krall to urge her not to testify, and Bell said he sternly dressed down Turner for that, and CIA "foot-dragging." Eventually, Krall testified at the trial. Truong and an associate, former U.S. Information Agency officer Ronald Humphrey, were each sentenced to 15 years in prison.

Bell also won over Carter in another interagency battle in 1978, this time over prosecuting Vladik A. Enger and Rudolf Chernyayev, two Soviet U.N. diplomats, who paid $20,000 to a Navy officer -- actually an FBI plant -- for documents on antisubmarine warfare. Because they worked for the United Nations rather than the Soviet mission there, they had no diplomatic immunity and could be prosecuted.

There was "a fierce debate within the administration" over the case, Turner wrote. Then-Secretary of State Cyrus Vance "felt we had more to lose by antagonizing the Soviets than we would gain by putting a couple of spies in jail. A summit meeting between Carter and Soviet President Leonid Brezhnev was coming up the following month, and negotiations on SALT II were also in a delicate stage." Turner told Carter that he feared that the Soviets would retaliate against U.S. spies in the Soviet Union.

Carter responded to Turner that, "based on the quality of information he had been receiving, he was surprised we had anyone working inside the Soviet Union," Bell said. The president also approved prosecution.

The Soviets did crack down briefly on Americans in Moscow after Enger and Chernyayev were each sentenced to 50 years' imprisonment. They later were traded for five Soviet dissidents.

"It finally comes down to whether we follow 400 spies around . . . or we catch somebody and put them in the penitentiary once in a while," Bell said in an interview last week. "I think we have too many spies and potential spies in this country."