Federal investigators are attempting to determine whether city officials deliberately tried to thwart their probe of D.C. contracting by carrying out electronic surveillance sweeps of Mayor Marion Barry's campaign headquarters and the homes of several Cabinet members, several sources said.

A private security firm, Mele & Associates, received $10,000 to $12,000 in city funds last year to sweep an estimated nine locations and check about 30 phone lines at the direction of D.C. police Lt. Ronald Harvey, who then headed the mayor's personal security detail, according to one source.

Previously, it has been reported that electronics expert Eddie T. Dockery swept Barry's home and office several times between 1984 and September 1986. In a telephone interview Wednesday night, the mayor said he was informed of the other searches only "in passing," and was not involved in the decision to look elsewhere.

Police sources said Police Chief Maurice T. Turner Jr. was not aware of the decision to hire the firm and Capt. William White III, a police spokesman, said the department can find no record of payments to the company. Barry said he assumed that Harvey informed his superiors of his activity.

Federal investigators are examining whether the searches uncovered court-ordered devices and interfered with the investigation. Whether such searches could be construed as an obstruction of justice, however, is open to debate, according to several prominent defense attorneys.

William G. Hundley, a well-known white-collar defense lawyer and former Justice Department official, said he could see nothing illegal in searching for bugs or wiretaps unless the city officials knew that the devices had been planted by federal authorities. "They would have to have proof that they knew there was a court order authorizing them," he said. "Your home is still your castle."

Dockery, an electronics expert working as a consultant for Mele & Associates, testified about the searches before a federal grand jury last month. Anthony Mele, the firm's president, said yesterday that he discussed the searches with FBI agents and turned over the firm's invoices for the work to them after receiving a subpoena for the documents.

Barry said he had been advised that there was "no obstruction of justice or anything illegal" in any of the searches.

Mele said, "Nothing that Mele & Associates did was illegal or improper or immoral. Lt. Harvey ensured that we always stayed within the guidelines and the tenets of the police department."

Harvey, now working in the police department's 5th District, declined to comment.

Federal authorities are apparently attempting to determine exactly which locations and phone lines were checked. Mele said that FBI agents asked for addresses and phone numbers, but said he told them he didn't remember the addresses and never knew the phone numbers. "They left it at that," Mele said.

According to one source, Dockery also was asked to identify the addresses, but told prosecutors he didn't remember them and kept no records of the searches.

U.S. Attorney Joseph E. diGenova issued a statement last month saying that federal authorities did not bug or wiretap Barry's home, office or car from 1984 to the present.

However, federal authorities, in connection with a 17-month undercover probe that was disclosed May 22, are believed to have tapped phones used by David E. Rivers, a top adviser to Barry, and John B. Clyburn, a businessman whose firms have held numerous District contracts. Tapes played to grand jury witnesses also indicate that federal authorities bugged Clyburn's office, sources have said.

One source said Mele and Dockery swept for bugs and checked the phone line at Rivers' home. John Mercer, an attorney for Rivers, said yesterday that Rivers "never had anybody to come in and check his house for surveillance. He doesn't know the guy Dockery. Obviously he didn't authorize it or give anybody any permission."

Sources said Mele and Dockery checked the residences of City Administrator Thomas M. Downs and several other Cabinet officials. Barry said that "apparently some people" in his Cabinet "asked that it be done."

He said the check of his campaign headquarters "was mentioned to me in passing. I didn't pay that much attention to it." Barry said he did not object to the sweeps if the security detail felt "it would help the security of the government," as long as no laws were violated.

"They can put a bug in my lapel if they want to," he added. "I've always been lawful and truthful."

Dockery has said he first checked Barry's home for bugs or phone taps in 1984. Sources said Harvey hired Mele & Associates, a District-based security consulting firm, in February 1986 to search other locations. The work, which continued over several months, involved nighttime visits to empty homes, a source said.

Mele and Dockery reported to Barry that they uncovered evidence of electronic eavesdropping devices at Barry's home, office and other locations, although some experts have questioned whether the sophisticated equipment can be discovered with the methods used by the firm.

Barry was informed by Mele or Harvey whenever they believed they had found evidence of eavesdropping, one source said.