The Supreme Court ruled 7 to 2 yesterday that evidence obtained by a federal agency in admitted violation of its own rules can be used in a criminal prosecution.

The case involved electronic surveillance of a taxpayer who tried to bribe an Internal Revenue Service agent. Neither the consitutional nor the statutory rights of the taxpayer were violated, the court emphasized.

But the dissenting opinion warned that the decision "must inevitably erode respect for law among those charged with its administration" and necessarily confer upon the judiciary a "taint of partnership in official lawlessness."

The case began in March 1974 when IRS agent Robert K. Yee went to see San Francisco dentist Alfredo L. Caceres and his wife, who kept the office books, in connection with an audit of their 1971 tax returns. They owed $3,200.

After Mrs. Caceres left the room, the dentist offered Yee $500 as a "personal settlement." Yee stalled, but immediately on returning to his office reported the offer to his superiors and prepared an affidavit describing it.

Following regulations in the IRS manual, Yee also got official permission to monitor several conversations with Caceres with a concealed radio transmitter and tape recorder.

The issue in the case arose the evening of Jan. 30, 1975, when Caceres agreed to meet Yee at 2 p.m. the next day. The IRS regional inspector phoned Washington to get emergency approval for Yee to monitor and record the meeting. On the same day, the IRS, as required by the manual, asked the Justice Department in writing for a 30-day authorization to monitor and record face-to-face conversations with Caceres.

At the Jan. 31 meeting, Caceres gave Yee $500 and promised to give him another $500 when he was notified by the IRS that it would settle the $3,200 deficiency for $1,000. The arrangement would have saved the dentist $1,200.

On Feb. 5, Yee arranged for the next day a meeting with Caceres to review the settlement. At this meeting, the dentist not nly renewed his pledge to pay the additional $500, but also offered Yee an extra $2,000 to help settle his 1973 and 1974 returns.

The Justice Department, however, hadn't yet acted upon, and possibly hadn't even received, the written request to authorize the 30-day monitoring.The authorization came through, and began, Feb. 11-in time to cover Cacere's payment of the additional $500, but useless for the Jan. 31 and Feb. 6 meetings.

Because of the lack of Justice Department authorization required by the manual, a trial judge granted a motion by Caceres to suppress the incriminating tapes. The judge said that the emergency provision couldn't be invoked because the emergency had resulted from the agency's scheduling. The 9th U.S. Circuit Court of Appeals affirmed.

The Supreme Court reversed. For the majority, Justice John Paul Stevens wrote that the Constitution had not required the IRS to adopt the regulations, that the law impose no restriction on a recording made with the permission of one of the parties to it, and that the agency had made "a reasonable good-faith attempt to comply" with the manual.

Dissenting were Justices Thurgood Marshall and William J. Brennan Jr.