An espionage ring allegedly headed by John Anthony Walker Jr. enabled the Soviets to break the code on some of the Navy's most secret messages to the fleet in the 1960s, possibly reducing the U.S. lead in antisubmarine warfare in the process, top Navy officials said yesterday.

The Pentagon also announced several measures designed to solve problems underscored by the Walker case and other security breaches.

Defense Secretary Caspar W. Weinberger ordered an immediate 10 percent reduction in the 4.3 million military and civilian personnel cleared to see secret information. He also announced formation of a special panel to identify "any systemic vulnerabilities or weaknesses" spotlighted by charges against retired Chief Warrant Officer Walker and three other Navy men accused of espionage.

Navy Secretary John F. Lehman Jr. said he will seek congressional approval for random lie detector tests for people dealing with classified information. He said the questions would focus on dealings with foreign governments and not on personal matters.

In the first official assessment of potential damage stemming from the alleged Walker spy ring, Chief of Naval Operations Adm. James D. Watkins said the loss appeared to be "very serious" but "not catastrophic."

At the same Pentagon press conference, Lehman urged Congress to reinstate the death penalty for persons convicted of espionage. He said the Navy's efforts in the meantime will be designed "to increase the common wisdom" that the penalty for breaking security "is very, very high."

In a separate interview, Stephen S. Trott, the assistant attorney general in charge of the Justice Department's criminal division, also urged Congress to make spying a capital crime. He said this would deter potential spies in an era when, according to intelligence officials, most espionage is motivated by money rather than by ideology.

The maximum penalty for espionage at present is life in prison, and those sentenced to life become eligible for parole in 10 years. In addition to authorizing the death penalty, Trott said, Congress should make the crime punishable by life imprisonment without the possibilty of parole.

"You can't deter an ideologue, somebody who's bought into the Russian way of living," Trott said. "But the guy who needs some extra money for a Porsche or a condominium in Ocean City or a few more girl friends, those guys are going to be deterred if the FBI comes down on them and says, 'Okay, you're going to spend the rest of your life in jail.'"

At the Pentagon press conference,, Watkins said the Navy will spend millions of dollars to change the secret coding gear believed compromised. He added that submarine, ship and airplane tactics in warfare may have to be "modified" to offset the presumed loss of secrets to the Soviets.

However, Watkins disputed recent published reports that the Soviet Union may have perfected ways to detect U.S. missile submarines.

"There is no indication that the Soviets have broken the code on how to detect" U. S. missile submarines, he said. Navy officials, he said, "remain convinced" that the missile submarine force "is still 100 percent survivable."

Reading from a paper that had secret information on one side and an unclassified summary on the other, Watkins said Navy communications "is the most serious area of compromise."

The design of some secret Navy communications gear "probably has been lost" to the Soviets, he said, and the service is building new equipment on an "accelerated basis" in the hope of foiling would-be Russian eavesdroppers.

Soviet electronic eavesdropping trawlers trail American warships at close range on seas all over the world and, Navy officials presume, record the ships' message traffic. Gear that would unscramble the intercepted communications, combined with the reports on surface ship and submarine operations that may have been provided by the alleged espionage ring, would have been immensely helpful to Soviets trying to determine the military intentions and capabilities of the United States, according to military officials.

Watkins said the Soviets' presumed ability to break U.S. codes would permit them "to fill voids in their knowledge and . . . to better understand what they observed, a very valuable intelligence gain to the Soviet Union."

Maximum vulnerability to the U.S. submarine fleet came between 1962 and 1969, according to the Navy's current assessment. The alleged espionage began in 1965, federal prosecutors charge.

John Walker, 47, who held top secret clearance during much of his Navy service, repaired coding machines and other sensitive communications equipment in 1963 at the Navy's Crypto Repair School in Vallejo, Calif. He also served as the radioman on two nuclear-powered missile submarines, the Andrew Jackson from 1962 to 1965 and the Simon Bolivar from 1965 to 1967.

The others arrested and charged with espionage in the case are Walker's brother, retired Lt. Comdr. Arthur James Walker, 50; John Walker's son, Seaman Michael Lance Walker, 22; and John Walker's friend, retired Senior Chief Radioman Jerry Alfred Whitworth, 45.

While John Walker was on missile submarines and while he served as the communications watch officer in 1967 at the Atlantic Fleet's headquarters in Norfolk, Watkins said, "we must assume" that the Soviets had "real time information from the message circuits important to submarine operations. Clearly this gave them a leg up on understanding U.S. submarine practices and procedures to help them in their counter-strategies."

From the documents and the message traffic, he said, the Soviets "could have learned about tactics and procedures used in air and antiair warfare." He said Walker's information made Soviet observation of naval air and sea operations "more effective, and filled important voids in their bank of knowledge.

"We witnessed them gaining on us in the technology differential that was significant 10 years ago and has been shrinking," Watkins continued. "Perhaps the Walker case contributed to the rate of closure of the significant technological gap that existed a decade ago and is beginning to close at a high rate."

In the interview, Trott declined to say whether additional arrests are anticipated in the case. But, he said, "You can bet your bottom dollar that there will not be a rock or a stone unturned in this case."

Trott also said federal investigators have not yet determined whether John Walker first approached the Soviets or whether Soviet agents solicited him.

"We don't know the genesis, the first contact, whether he started or they started," Trott said.

He said one of the unusual things about the allegations in the Walker case was the size of the alleged espionage ring. "Usually these people are independent contractors, because they sense it's something that's not going to go down well with other people," he said.

Trott said that reducing the number of Soviet citizens permitted to live in the United States is "certainly something that ought to be considered" as a means of curtailing espionage activity. The Senate passed a measure Friday limiting the number of Soviets with diplomatic immunity in the United States to the number of Americans with such immunity in the Soviet Union.

"There's no doubt about it: every time you have a Russian come into the U.S. you've got to think 'possible case agent,' " Trott said. The State Department, however, has opposed the measure passed by the Senate, and Trott cited "countervailing considerations" against such a move, declining to say whether he thought its positive features outweighed negative aspects.

Trott said the espionage case against John Walker turned out to be bigger than FBI agents had first expected when Walker's ex-wife came to them with allegations that her former husband was spying for the Soviet Union.

"The wife came in and said, 'I think this guy's pulling some stuff,'" Trott said. "This has probably turned out to be larger than one might have guessed."

Also yesterday, two Norfolk police officers, including John Walker's girl friend, said they had lost their jobs because of their connections to Walker.

Pamela K. Carroll, Walker's girl friend and a former employe at a Virginia Beach detective agency that Walker owned, said yesterday in a statement released by her attorney that she was fired from her job Monday without explanation and without cause.

"I have no knowledge of any espionage nor other illegal activities by John Walker," Carroll said in her statement. "I have cooperated fully with all law enforcement agencies . . . . I have been advised that the authorities are convinced of my lack of complicity and my innocence."

Carroll, whose one-year probation period as an officer would have ended early next week, said all her monthly evaluations, including one issued last Friday, "have been excellent."

Because of Carroll's probationary status, the department is not required to inform her of the grounds for her firing, according to Sgt. R.H. Leonard, a police department spokesman, and James R. McKenry, Carroll's attorney.

McKenry said internal investigators for the department asked Carroll whether, as a favor for Walker, she had checked state Department of Motor Vehicles records on one individual. Carroll didn't "specifically recall" any such instance but "couldn't specifically deny it," McKenry said.

McKenry said Carroll worked for Walker's detective agency, Confidential Reports Inc., for about a year as an investigator before joining the police department, but "did no investigations, no paid work, no nothing after that."

A second police officer, Jack R. Bernard, said he retired from the force Friday rather than face suspension for working for Walker's agency without obtaining the permission of the police chief, required for all outside work.

"If he [Walker] hadn't been who he was, there probably would not have been anything said about this," Bernard was quoted as saying.

Also yesterday, the FBI said it is reviewing numerous rolls of film, computer discs and video and audio recordings seized from John Walker's Norfolk home and office to determine whether they shed any light on the alleged espionage ring.

U.S. Magistrate Gilbert R. Swink signed a search allowing agents to review the tapes and process undeveloped negatives and rolls of film on May 31, according to documents released in federal court in Norfolk.