The D.C. Court of Appeals upheld the authority of the District government yesterday to require equal treatment of homosexual student groups at Georgetown University, but said the university does not have to "officially recognize" them.

The 5-to-2 decision by the District's highest local court comes after seven years of legal wrangling that has pitted the Roman Catholic university against student groups that reject church teachings condemning homosexuality.

It is the first time that a state's highest court -- to which the D.C. Court of Appeals is equivalent -- has ruled that banning discrimination against homosexuals has the same important constitutional status as banning discrimination against blacks and women.

The 171-page opinion requires that Georgetown University give homosexual organizations the same "tangible benefits" as other student groups, including the right to apply for university funds. Despite that, it also appeared to satisfy Georgetown officials, who stressed that their primary concern in the case was preserving their right to refuse to formally recognize a group that opposes Catholic beliefs.

In a statement, the Rev. Timothy J. Healy, university president, said he was gratified that the court upheld "the university's right to refuse to endorse moral positions not in accord with its traditions." Healy also said, "The university must now study the court's decision to determine what additional steps it must take."

A university spokesman said Georgetown had not yet decided whether to appeal the ruling to the U.S. Supreme Court.

The D.C. Human Rights Law, which was passed in 1977, bans discrimination on the basis of "sexual orientation" and 15 other categories, including race and sex.

Judge Julia Cooper Mack, writing for the Court of Appeals majority, said the "compelling governmental interest" in the "eradication of sexual orientation discrimination" is similar to that in banning race and sex discrimination.

She said this "overriding interest . . . outweighs any burden" that might be placed on Georgetown's constitutional right to religious freedom by forcing it to give homosexual groups the same benefits as other student groups, such as mailing facilities and free use of its computerized label service.

But Mack said the law does not require "university recognition" of the homosexual groups, which she said Georgetown "sincerely regards" as a "religiously guided . . . 'endorsement.' " She said it could not compel such an endorsement without violating constitutional rights of free speech. The D.C. statute does not seek "uniformity in philosophical attitudes," Mack said, "it does require equal treatment."

Richard A. Gross, an attorney for the students, called the decision "enormously significant" because it holds that "gay rights have the same status as a compelling interest as race and sex discrimination."

Nan Hunter, director of the Lesbian and Gay Rights Project of the American Civil Liberties Union, said it would have "a tremendously important impact on strengthening the validity of local human rights statutes" across the country.

In his statement, Healy said Georgetown "has never had a problem providing support services to a great variety of student groups" and that "many of these services have been and are available" to the homosexual groups, including free use of university meeting rooms and the right to advertise events on campus.

"We hope that following this ruling," Healy said, "the university community will be able to put this divisive issue behind us."

The Gay People of Georgetown University, the main campus group, was formed in 1977. It has 15 members. Another homosexual organization has about 25 members at the university's law school.

The Gay People received preliminary "endorsement" from a student government group in 1978, but was turned down twice by administrators when it applied for "university recognition."

About 50 groups -- including the student newspapers, political and ethnic minority and women's organizations -- have such recognition. Many receive some university funds.

The case, which has attracted nationwide attention, began in 1980 when the homosexual groups sued the university. It already has been the subject of two rulings in D.C. Superior Court and a decision in 1985 by a three-judge panel in the D.C. Court of Appeals, requiring official university recognition of the gay groups. The effect of that ruling was immediately stayed when the full court announced it would rehear the case.

Meanwhile, the D.C. government has refused to approve $200 million in tax-exempt bonds for the university.

It took the full court two years to issue its ruling, which includes concurring or dissenting statements by each of the six other judges in addition to the majority opinion by Mack.

The majority opinion declares that the District's ban on discrimination against homosexuals is an effort to eradicate "a grave evil that damages society as well as its immediate victims."

Judge Frank Nebeker, one of the two dissenters to the ruling, blasted the majority for forcing "a religious body, contrary to its basic tenets, to provide services and facilities to those who advocate and proselytize abnormal and criminal sexual practices."