A federal judge here ordered pacifist sailor Leslie Anne Cole discharged from the Navy as a conscientious objector today and freed her from prison at nearby Fort Meade.

The slender, 28-year-old Cole, jailed since Feb. 26 after being court-martialed for refusing to work or wear her uniform, walked out of the federal court building here surrounded by family and well-wishers.

"I feel like I have come back home where I belong in my soul," she told reporters. "I feel great."

Cole had spent much of her time in solitary confinement wrapped only in a bedsheet because of her continued refusal to wear a uniform and the Army's refusal to let her wear civilian clothes at Fort Meade. A compromise was eventually reached in which she wore military hospital pajamas and bathrobe.

Cole was freed today--two days before her jail sentence was to be completed--after U.S. District Court Judge Walter E. Black Jr. ruled that her conscientious objector application, held up by the Navy because of her court-martial, was valid and should be granted.

"She was entitled to her discharge at the time of the court-martial," Black told the courtroom filled with spit-and-polish military officials and more casually dressed supporters of Cole. "Her ill-considered actions disobeying orders to work and wear her uniform should not disentitle her now."

Cole, one of nine children of a Lutheran family from Bethlehem, Pa., enlisted in the Navy in 1981 and became a firefighter on a submarine tender based in Norfolk. She has said she began questioning the morality of her combat-related work in the summer of 1982 and formally applied for conscientious objector status later in the year.

An administrative hearing officer found her moral and philosophical objections to war and "bearing arms" to be genuine and recommended her discharge. While waiting for the Navy to process the recommendation in January this year, Cole says her pacifist feelings, bolstered by seeing the movie "Gandhi," became so great that she refused to go to work or wear her uniform.

She was then court-martialed and sentenced to 60 days in jail and ordered expelled from the Navy with a bad-conduct discharge. Her conscientious objector application was automatically suspended while the court-martial findings underwent routine legal review by the Navy, a process that could take months or years.

Civilian attorneys for Cole rushed into federal court here last week asking that the Navy review process be bypassed, contending that it effectively blocked the conscientious objector avenue she sought.