A military judge refused to dismiss spy charges against Air Force 2nd Lt. Christopher M. Cooke yesterday but held that his confession was tainted and could not be used against him.

The government now must show that it has enough independent evidence to convict Cooke at his court-martial at Andrews Air Force Base.

The judge, Lt. Col. David Orser, ruled after two weeks of hotly contested pretrial hearings that a statement given by Cooke to Air Force investigators last May 17 had been coaxed from him by "unauthorized promises of immunity."

"Clearly the accused relied on such promise(s) to his detriment," Orser said in a 15-page ruling. He said the confession clearly was "involuntary, in that it was obtained through the use of unlawful inducement . . . . "

Orser rejected the defense contention that the case should be dismissed. Air Force prosecutors say they have enough untainted evidence to support all 14 counts of espionage and related offenses brought against Cooke for surreptitious telephone calls and visits to the Soviet Embassy here.

A studious-looking officer who served as deputy commander of a Titan II missile crew near Wichita, Cooke, 26, called his home in Richmond shortly after the decision was announced.

"We're not surprised," his mother, Betty, told reporters later. "This judge had a chance to make history. He made up his mind coming in and going out . . . . Why moan and groan about it? My son will come out of this."

Despite the judge's decision, Cooke's chief defense counsel, F. Lee Bailey, said he was "very pleased" with the ruling and saw it as foreshadowing ultimate victory on appeal.

Most of the decision was devoted to findings of fact, and these were "all we were looking for," Bailey declared in a telephone interview from Florida where he was tending to other business. On that score, he said, "we clearly came out the winners."

The court put much of the blame for the immunity snafu on Brig. Gen. C. Claude Teagarden, the chief legal adviser for the Strategic Air Command in Omaha, Neb.

Although Teagarden testified that he had never authorized immunity for Cooke, Orser held that the general plainly conveyed that message to the chief Air Force investigator in the case and to Cooke's military lawyer in telephone conversations with the two officers last May 9.

"I find as fact that Gen. Teagarden, regardless of what he may have intended, did communicate . . . that if the accused made a full disclosure, took and passed a polygraph, he would be discharged and there would be no prosecution," Orser held.

"I do not believe he meant the agreement to be so all-encompassing. Nevertheless, his words conveyed that message," Orser said.

Orser also found that Teagarden "had actual and apparent authority to act as the Strategic Air Command leader's legal spokesman on the Cooke investigation . . . . "

As a matter of law, however, Orser held that any binding offer of immunity must be ratified "by one who has actual authority" and by affirmative action, not silent acquiescence. Orser said Gen. Richard H. Ellis (USAF-Ret.), then the SAC commander, never gave necessary approval.

Defense lawyer Kenneth Fishman said he would ask the U.S. Court of Military Appeals to order the proceedings halted and to take up the immunity issue immediately. The appeals court voted, 2 to 1, last month not to intervene, but Bailey noted that "one judge wanted to throw the case out then, and another said he wanted findings of fact" first.

To some extent, Orser's ruling also faulted officials of the Air Force Office of Special Investigations for going beyond the letter of their initial instructions from SAC last May 5 and assuring Cooke from the outset that SAC was not interested in prosecuting.

But Orser also noted that the chief OSI investigator in the case, Lt. Col. Jerome Hoffman, had notified SAC "in precise detail" May 13 of "the terms of the agreement for no prosecution, the OSI believed existed . . . . "

Despite that message, "no reply was forthcoming from SAC to the accused, to his counsel, or to the AFOSI agents conducting this investigation, denying the existence of the agreement or contesting any of its terms," Orser said.

Besides invalidating Cooke's confession, Orser emphasized that any government evidence derived from it "will suffer a similar fate."

Pretrial hearings must be conducted on the validity of the government's case. Most of it is still classified, but testimony in the last two weeks suggests that it was compiled after Cooke made his confession.

"The Air Force could wind up having no usable evidence left," Bailey said.