Barbara Underwood and four other members of the Unification Church went into a San Francisco court last month to prevent their parents from taking them into custody and having them professionally deprogrammed of their religious beliefs.

Before the dramatic 11-day court hearing was over, Underwood and three of the other four had renounced years of what Underwood characterized as "fervent loyolty" to the cult of the Rev. Sun Myung Moon. In effect, they had been deprogrammed by the court procedure.

"At the hearing I began to see both sides of the issue," Underwood explained yesterday in a telephone interview.

Uneasiness over pressure from cult leaders to "defend the church [in her sworn testimony] as blameless" and conversations with ex-Moonies who were spectators and witnesses at the trial completed her deprogramming, said the 25-year-old resident of Portland, Ore.

On Monday an appellate panel overturned the lower court's grant of parental custody over their adult children and left the five free to return to the Unification Church.

But only one returned - John E. Hovard Jr., 23, of Danville, Calif. The other four, including Janice B. Kaplan, 24, of Toledo, Ohio, who Underwood said she help deprogram last weekend, left for Arizona for a month of rehabilitation away from possible influence of Moon loyalists - a step advocated by professional deprogrammers.

Underwood said the defections from the cult for all four were the result of the combination of "hearing both sides" during the court procedure and the "dialogue" with ex-Moonies.

The defections, without the assistance of professional deprogrammers, throws new light on the controversy over deprogramming young people caught up in cult groups.

"In the [Unification] church, deprogramming is set up as something inhuman, as physical abuse or mental torture," Underwood said yesterday. "It was never presented to us as just dialoguing, talking with someone."

Underwood, whose father, Raymond, was a former aide to Sen. Mark Hatfield (R-Ore.) and is now chief counsel for the Oregon State Department of Justice, said she and the other four were "briefed" by cult leaders on "how to resist, how to close oneself off" to testimony of anti-cult witnesses.

"To me, that was such a flaw in one's faith, it made me all the more want to listen almost as a test of my faith" in the Unification Church," Underwood said.

The young woman, who was valedictorian of her high school class and was in her third year as a sociology major at the University of California at Santa Cruz when she joined the church, said she now believes she was "definitely under mind control" in the church.

"This is something courts don't understand, something lawyers don't understand - you don't understand it if you haven't experienced it," she said.

"My belief was so fervent," she said. "When I realized I was doing something that was beyond the law. I never thought of questioning (orders of the leaders), I justified it to myself by saying people outside the church don't understand."

Cult members are taught, she said, that "if you ever leave the church you face spiritual death." She was "made to feel guilty" if she wanted to visit her parents, she said. "It's a sign of faithfulness (to Moon and his principles) to be able to give up loving relationships."

She began to have qualms of conscience and doubts, she said, when she was called as a witness during the trial. Because of the loyalty the church demanded, she explained, "there were many things on the witness stand I couldn't be truthful about, yet there I was talking about 'God's love' and 'God's witness'."

She expressed no bitterness toward this cult, but said firmly: "The whole issue of mind control really has to be exposed to the American public. People don't really know what's happening."