The espionage committed by John A. Walker Jr. "very well could have" cost American lives during the Vietnam war because the Soviets were able to decode top-secret messages about U.S. military plans and pass information along to North Vietnam, Navy Secretary John F. Lehman Jr. said yesterday.

In any wider conflict with the Soviet Union during the 18 years that Walker's spy ring operated, the compromises in coded messages could have had "devastating consequences" for America, Lehman said.

During an interview, a clearly angry Lehman assailed the plea-bargain agreement in the Walker case. He said that the espionage was not "just another white-collar crime," that the plea bargain has sent "the wrong message to the nation and to the fleet," and that such spying "ought to have the death penalty." The Navy, Lehman said, did not need Walker's cooperation to learn what damage it had suffered.

Assistant U.S. Attorney Michael Schatzow, who prosecuted Walker and his son, said of Lehman's remarks, "If the secretary of the Navy actually said that, you have to wonder why it is that people who are superior to him authorized this agreement . . . . "

The Navy, on the basis of its exhaustive damage assessment, "assumes" the Soviets learned about their weak points through Walker's spying and took remedial steps, including making Soviet submarines quieter and deeper-diving, Lehman said.

He compared the code-breaking help the Walker ring gave the Soviets to Project Ultra in World War II. The Poles in 1939 gave the British and French a highly secret German coding machine named Enigma. The British, under Project Ultra, built a machine that decoded the secret messages the Germans sent over Enigma throughout the war.

"Had we been engaged in any conflict with the Soviets" while the Walker spy ring was operating from 1968 until this spring, Lehman said, "it could have had the devastating consequences that Ultra was to the Germans."

Defense Department officials said the Walker ring not only supplied the key cards needed to work U.S. coding machines but also provided information about the inner circuitry of the machines, making it easier to decode messages from all U.S. armed services and intelligence agencies.

"We assume that the Soviets were able to compromise the design logic of some of the cryptographic machines, which would enable them in some cases to crack the code without key cards. And we assume they have," Lehman said.

What the Soviets probably did, according to intelligence officials, was to follow the British example under Ultra and build a machine that could decode messages sent from country to country, from ship to shore and from ship to ship.

The Navy, Army, Air Force and Marine Corps are buying new coding machines, and Lehman estimated the cost at $100 million.

Walker, a former Navy chief warrant officer with top-secret clearances who sent out coded messages, was in the Navy from 1955 to 1976. He held such sensitive jobs as chief radioman on a submarine and watch officer at the Atlantic Fleet's message center in Norfolk.

During much of the Vietnam war, Lehman said, the Soviets were decoding U.S. messages on what ships were going where, what troops could and could not do on the ground and the limits placed on U.S. bombers.

"We have to assume," Lehman said, that Moscow passed to the North Vietnamese at least some of the secret messages it intercepted about U.S. military movements and tactics.

In response to a question, Lehman said the Walker ring's espionage "very well could have" led to U.S. deaths in Vietnam "if we are able to establish that compromises and operational information was passed" to Hanoi.

"We do not know enough yet, nor are we likely to find out from him John Walker , but we will probably be able to establish" how much operational information the Soviets intercepted during the Vietnam war, Lehman said. He said if considerable information was intercepted and passed on to the North Vietnamese because of the Walkers, "They would have directly led to the losses."

In discussing how the spy ring helped the Soviets further safeguard its military, Lehman said the intercepted messages told Soviet naval leaders at what ranges the United States could detect submarines.

"This enabled them to speed up the development of submarines with capabilities to beat the capabilities they knew we had through these compromises -- quietness especially and deeper-diving," he said.

Lehman said the Navy views the type of espionage admitted by John Walker and his son Michael as "the gravest of all possible crimes and we intend to treat it as such." He said the Navy is hopeful of gaining jurisdiction and authority in future cases to impose the death penalty for espionage in peace as well as war under legislation before Congress.