The United Church of Christ filed suit yesterday in federal court here to overturn a two-year-old Internal Revenue Service ruling that sharply limits the right of nonprofit groups to publish the voting records of candidates.

Under the ruling, nonprofit groups lose their tax-exempt status if they publish voting records in a way that implies a political endorsement.

Specifically,the ruling prohibits single-issue organizations from publishing votes on that issue -- such as a conservation group reporting votes on a land-use bill.

It also prohibits providing voting records in a publication that reflects the group's stand on any one of those issues. It was this point that the United Church's Washington-based Office of Church in Society objected to. u

Before the IRS made its ruling in June 1978, the Church in Society office, in its monthly publication, Washington Report, recorded the votes of members of Congress on 10 different issues. The votes were recorded in the publication, not by "aye" or "nay" but by "whether [the member] supported or opposed the [Church in Society] staff's positon," the newsletter noted.

The Rev. Barry Lynn, of the church's Office, said yesterday that his organization has repeatedly tried to get the IRS to clarify whether the Office would violate the ruling if it resumed publishing the voting records. "But we have just gotten nowhere," he said.

So, he said, the social action arm of the 1.7 million-member church, assisted by the American Civil Liberties Union, decided to take the IRS to court for "interfering with its First Amendment rights to publish voting records of members of Congress."

An IRS official said it was "our normal practice not to comment on matters that are before the court."

The IRS ruling has been particularly annoying to Roman Catholic publications that want to run the voting records of candidates on abortion. Thus the UCC suit may have an impact on the more than 470 Catholic publications in this country.

While Catholic editors have generally been careful to steer clear of the IRS ruling, one priest-journalist, the Rev. Bryan Wallace of Today's Catholic in San Antonio, openly defied it earlier this year. In an editorial crying "Nuts to the IRS," Wallace published the records and positions on abortion of candidates in the April 5 Texas primary.

David Landau of the ACLU, who filed the UCC case yesterday, emphasized that the publication of voting records by the Church in Society unit was for broad educational purposes. "The United Church of Christ has never endorsed a candidate and it doesn't contribute to elections," he pointed out.