A federal judge here yesterday ordered Navy Secretary John F. Lehman Jr. to expunge an official censure from the record of a former Marine Corps colonel who was accused of misconduct while spending more than five years as a prisoner of war in North Vietnam.

U.S. District Judge Gerhard A. Gesell sharply attacked former Navy secretary John Warner, now a Republican U.S. senator from Virginia, for a lack of "rudimentary fairness" in deciding to issue the censure in 1973 against the retired colonel, Edison W. Miller.

Gesell also criticized Lehman for refusing to accept the recommendation of a Navy review panel that the censure be expunged.

"This is manifestly a case that 'shocks the sense of justice,' whatever the technical legalities may have been," Gesell said in a 21-page decision. "No legal training is required to know that in a society that enshrines fundamental fairness as one of the highest public values, what happened to Colonel Miller was wrong.

"A military officer with a long and honorable career may not be publicly condemned by the highest commander of his service for serious dereliction of duty without an opportunity to know the accusations against him and to defend himself," Gesell said.

Miller, now 53 and a lawyer in southern California, was shot down in a combat mission over North Vietnam on Oct. 13, 1967, suffering a broken back, crushed ankle and other injuries while he ejected from his plane.

Upon Miller's return to the United States, however, Rear Adm. James Stockdale filed charges against him that he solicited fellow POWs to mutiny, informed on fellow POWs and refused to obey superior POWs.

Warner, after reviewing the charges, eventually dismissed them, but censured Miller instead. Warner and his staff refused to give Miller and his lawyers the specifics of the charges, access to investigative reports or names of adverse witnesses against him.

"I'm delighted about the decision," Miller said last night, "but I'm irritated that simple justice took so long. For 11 years, they've been calling me a traitor. I didn't quit in prison."

Miller said that while he was a POW he did issue statements that the war was "harmful to the U.S.'s best interests. I said this was a war the U.S. should never have been in."

A Navy spokesman said Lehman was aware of Gesell's decision, but would not comment until he had a chance to read the decision.

Warner said he interviewed other POWS at length about Miller's actions in North Vietnam and also met with his lawyers about the case. But Warner said he declined to meet directly with Miller because "the case against him was so strong that I might have ended up having to testify against him about anything he said to me. At this time, I have no basis to consider my actions anything other than proper."

In the end, Warner said he decided not to start a court-martial proceeding against Miller so that other POWS, already drained by their imprisonment, would not have to undergo the ordeal of testifying and reliving their experiences and so that Miller's family would not face the possibility of losing military benefits should Miller be convicted at the court-martial.