A gay midshipman who sued the U.S. Naval Academy for discrimination should be allowed to bring his case to trial, the U.S. Court of Appeals ruled yesterday.

The decision sends back to U.S. District Court in Washington the lawsuit filed by Joseph Steffan, who was in the top 10 in his class at Annapolis when he resigned just weeks before graduation in 1987. He was facing certain dismissal after acknowledging to a superior officer that he was homosexual.

Steffan sued the academy and the U.S. Department of Defense in a legal challenge aimed at the military's policy of excluding gay men and lesbians from all branches of the service.

In late 1989, U.S. District Judge Oliver Gasch dismissed Steffan's case after the Minnesota native, who had received superlative marks from his academy superiors, refused to answer specific questions in a deposition with Navy lawyers about his sexual activity.

Steffan argued on appeal that Gasch had no right to try to force him to answer such questions, because the academy had based its dismissal action solely on an admission by Steffan that he was gay, rather than on any allegations or evidence of homosexual conduct. Steffan's appeal also cited his Fifth Amendment rights.

The appeals court agreed, concluding that because sexual conduct was not an issue in the dismissal action, it could not become an issue in his subsequent challenge of military policy.

Navy officials could not be reached for comment yesterday evening. The Defense Department can appeal the decision to the U.S. Supreme Court.

Steffan, who now lives in Connecticut, said he feels confident that the case, in which he is seeking an officer's commission and an academy diploma, will now be decided on its merits.

"What has happened to date has been a series of attempts by the governmment to stop the case from going to trial," Steffan said. "We have not even started talking about what we went to court for."

Steffan became a celebrity in the gay rights movement when he decided to fight the military's long-standing policy against homosexuality. Although it has been upheld in numerous court decisions, the policy has been coming under more frequent attack by gay rights activists, who claim it to be one of the country's last vestiges of institutional discrimination.