A federal judge directed Virginia prison officials yesterday to stop cutting the hair of an Indian inmate who argued that his long sandy hair is "a manifestation of our being, which is of God."

District Court Judge Oren R. Lewis held that the prison officials had violated the religious rights of Michael G. Gallahan, a part-Cherokee inmate, by subjecting him to mandatory haircuts.

The 28-year-old prisoner, being held at a state prison near Staunton, had claimed that he was a member of a Cherokee religious sect called Sons of Jacob who believe that hair is a sensory organ and that cutting it can affect an individual's mental and physical abilities.

Virginia prison officials said they had listened to Gallahan's claims, but told him he would have to have a haircut anyway. The prison's Institutional Services Guideline No. 864, they noted, says among other things that an inmate's hair cannot extend below his shirt collar.

"Long hair provides a convenient hiding place for weapons and contraband . . . obscures an inmate's features . . . is more difficult to keep clean," Warden John S. Gathright argued.

Gallahan, the son of a Cherokee mother and an Irsh father, filed suit in federal court in Alexandria, challenging both the Virginia attorney general's office and Gathright over the haircut policy, which he claimed violated his First Amendament rights to freedom of religion.

Lewis agreed yesterday, ordering prison officials to stop clipping Gallahan's hair, which had been known to reach his waist.

The department's haircut rules are fine, Lewis held, but "That is not enough to justify enforcement of the guideline . . . against Cherokee Indian prisoners, who have always worn their hair long in accordance with their sincere religious beliefs."

Gallahan, serving an eight-year sentence for discharging a firearm into a Fredericksburg building, was denied a request for damages amounting to $25,000.

But in his petition to Lewis he made clear that growing his hair was more important. With hair "we carry our own little bit of heaven with us," Gallahan said.