Nearly 600 gay rights advocates, including many who have AIDS, pushed past police barricades and were arrested on the steps of the Supreme Court Building yesterday during a boisterous but peaceful demonstration against discrimination based on sexual preference.

A court spokeswoman said it was the largest number of arrests ever at the courthouse.

Authorities at D.C. Superior Court, where the demonstrators were expected to be arraigned last night, reserved two extra courtrooms and stayed open late to help process the arrestees, many of whom were electing to spend the night in police custody rather than post bond.

Shouting "shame, shame, shame" at the marble edifice and scattering pink paper triangles like confetti, the hundreds of lesbians, gay men and their heterosexual supporters crossed police lines in waves during the hourslong protest, which culminated a week of gay rights activities in the nation's capital.

Helmeted police officers, many of whom wore protective surgical gloves, stood behind wooden barricades on the courthouse steps and arrested several separate contingents of demonstrators after they sat down on court property.

Protesters then walked, or were dragged and carried, to buses that transported them to D.C. Superior Court or to the D.C. Police Training Academy in far Southwest.

By 10 p.m., about 240 of the 572 arrested demonstrators had been charged. Some of them were refusing to give their names to court officials, slowing the booking process, according to some law enforcement officials.

Arrestees were expected to be charged with public space violation, a misdemeanor punishable by up to a $100 fine and 60 days in jail.

"This is not the first time gays have done civil disobedience," said Pat Norman, a San Francisco lesbian who helped coordinate Sunday's gay rights march here.

"Every day we commit an act of civil disobedience by loving each other," she said.

At a rally held across First Street NE from the Supreme Court, gay rights activists told a crowd of about 4,000 supporters that the court's recent decisions made it a logical protest target. Last year's 5-to-4 Bowers v. Hardwick ruling, which upheld Georgia's antisodomy law, was blamed for leaving gays "constitutionally homeless."

Michael Hardwick, the defendant in that case, was arrested at yesterday's demonstration.

As with Sunday's march, yesterday's protest illustrated the geographical diversity of the gay rights campaign as well as the wit and the rage of the demonstrators.

"Equal justice under the law, that's what it says on the wall," protesters chanted, pointing to the words carved above the court's front entrance.

The demonstrators, some of whom were arrested when they tried to charge past police at the back of the building, sang "America the Beautiful," "We Shall Overcome" and other songs and carried a variety of banners and placards, including the pink triangle, the identification that homosexuals were forced to wear in Nazi Germany.

"Decide sexual positions in the bedroom, not the courtroom," was one message. "Bob and Darrell -- outlaws for love" was another. Yet another sign, drawing on the civil rights focus of the protest, said that gays are entitled to life, liberty and the pursuit of happiness.

Michael Osborne, from California, went to the Supreme Court with $100 in his pocket and butterflies in his stomach about being arrested.

"This is my first time, and I am kind of nervous," he said.

"I've never even had a parking ticket before, but I'm going to do it because it is important for people to know we are here and what we are doing."

Osborne said that being gay used to make him feel isolated and "crazy . . . but I look around and see all these people, and I know I'm not. We are everywhere."

The first wave of demonstrators, about two dozen women, carried a large banner decorated with a pair of bright pink lips and the words "Lesbians protesting injustice." The women pushed through the barricade and ran, holding hands, to the middle of the white marble plaza. A few minutes later, police began to arrest them.

A contingent of "PWAs," or People With AIDS, marched to the lower court steps and sat down.

Some wore pink headbands, identifying themselves as carrying the acquired immune deficiency syndrome virus; others wore bright yellow gloves to mock the police precautions.

Many law enforcement officials throughout the country have begun wearing gloves in situations in which they fear that there could be violence and possible exposure to AIDS-contaminated blood. Rumors had circulated before yesterday's demonstration that some of the protesters with AIDS were planning to set themselves on fire or splatter blood on police. Organizers denied that any such actions were planned, and the protest was carried out peacefully.

There were poignant moments during the demonstration, especially when protesters stood on the courthouse steps, swaying to the sounds of their own humming and softly singing, "We are gentle, loving people, and we are singing, singing for our lives."

Despite reports from organizers that a few of the demonstrators were treated less than gently during their arrests, the police and the protesters appeared to grow comfortable with each other as the six-hour demonstration wore on.

At several points, the demonstrators even turned their humor on the police officers.

The chant, "Your gloves don't match your shoes, your gloves don't match your shoes," brought a flicker of a smile on the faces of some officers. Another rhyme, "Two, four, six, eight; how do you know your wives are straight," did not.

But by early afternoon, the

demonstrators took up another chant: "We're tired, we're bored; we want to go to jail."

Arraignment proceedings for the demonstrators did not begin until about 8 p.m. at D.C. Superior Court and was expected to last until about 1 a.m.

At the court last night, dockets were peppered with the names "John Doe and Jane Doe," representing defendants who, when arrested, gave their names as either "Harvey Milk," a gay San Francisco city supervisor who was shot and killed in 1978 by a former city supervisor, or "Sharon Kowalski," a gay Minnesota woman injured in a car accident two years ago, whose parents have rejected her lover's attempts to visit her.

Three courtrooms were set aside for the hearings, and as court commissioners began hearing cases, the rooms became packed with homosexual men and women, most of whom were members of gay support groups, who cheered and hugged their friends after sentencing.

Defendants were brought up in groups, and most pleaded guilty to at least one of the charges and asked the commissioners for community service in lieu of a fine or jail term.

While those requests were denied and defendants were forced to pay either a $50 fine or serve a three-day jail term, the defendants were allowed to make statements, and willing acceptances of guilt were proffered along with affirmations of gay pride.

Additionally, a few defendants, not wishing to pay money into a justice system they felt did not protect their rights, opted for trial at a later date.

Lorraine Sprecher, a lesbian from Santa Barbara, Calif., expressed the feelings of most who spoke to the court when she said, "I am guilty of being a lesbian. It's something I've dreamed of being guilty of forever."

It is illegal to stage a public demonstration on the steps of the Supreme Court Building. However, yesterday, the marshal of the court closed to the public the building, the grounds and the plaza in front of the court, and demonstrators were arrested after they stepped on court property.

One protester, Hillel Gray, took it upon himself to try to educate police officers about the AIDS virus.

Taking advantage of a captive audience, Gray faced a line of police who had batons at the ready, and tried to reassure them about the disease and their chances of contracting it.

"It is blood and semen you have to look out for," Gray said, leaning forward earnestly. "A lot of us may be infected, but it is a preventable disease. There is nothing for you to be afraid of."

Later in the afternoon, the American flag became a symbol of cooperation when one demonstrator ran onto the plaza, waving the flag over his shoulders, and sat to be arrested.

As he struggled to fold the flag, a helmeted police officer stepped in and took one end, and together they folded the flag into the traditional triangle.

Staff writers Nancy Lewis, Douglas Stevenson and Elsa Walsh contributed to this report.