NEW YORK, DEC. 18 -- An appeals court ruled today that a homeless woman who became the focus of the city's efforts to get the mentally ill off the streets may be kept hospitalized against her wishes for treatment.

The 3-to-2 ruling by the State Supreme Court's Appellate Division reversed a Nov. 12 ruling by Justice Robert Lippman, who ordered the city Health and Hospitals Corp. to release Joyce Brown, 40, from Bellevue Hospital.

For the past year Brown has lived on the sidewalk in front of a restaurant in midtown Manhattan.

"She has used this location as her bedroom, toilet and living room," the appeals court judges noted in the majority opinion.

She was hospitalized after Mayor Edward I. Koch's initiative to remove severely mentally ill homeless people from the streets if they pose a danger to themselves or others.

Brown, who took the name of Billy Boggs, a television personality she admires, has fought hospitalization, saying that she is not crazy but rather a dropout from society. Her last job, as a secretary, was in 1984.

After listening to psychiatrists who sometimes expressed opposing opinions, Lippman said he derived little guidance from them and therefore placed great weight on Brown's demeanor, behavior and testimony.

The appellate court said Lippman erred because the behavior and demeanor of Brown in court did not resemble her actions on the street and because the record indicated that she "has a propensity to lie."