D.C. Mayor Marion Barry said yesterday that an electronics specialist who did security sweeps for him told him that the FBI knew specific details about when the sweeps were done and "harassed" the specialist about his actions.

Barry said in an interview that he and Herbert O. Reid Sr., the mayor's counsel, talked with the electronics consultant, Eddie T. Dockery, on Thursday. Dockery appeared last Wednesday before a grand jury investigating D.C. government contracting.

"He told me about how the FBI had harassed him," Barry said. The mayor said Dockery told Reid that the FBI visited Dockery several times to discuss the sweeps, but that Dockery insisted that the authorities obtain a subpoena before he answered their questions.

The mayor questioned how the FBI could have known about Dockery's activities unless the bureau learned of them through listening devices. Earlier in the day, at his monthly news conference, Barry said that only he and his security staff had been aware of Dockery's electronic sweeps over a two-year period ending last fall.

In the interview, Barry said Reid and Dockery had lunch together on Thursday, the day after Dockery's testimony. Barry said he spoke briefly with Dockery when Dockery visited Reid's office, which is across the hall from Barry's. Barry said he did not know whether Reid or Dockery asked for the meeting.

Dockery, who could not be reached for comment last night, volunteered to the news media last week that he had been asked about the security sweeps, which were initially done as a favor. Barry said that the sweeps by the firm that employed Dockery were continued under a city contract with the D.C. police department.

Barry, in the news conference, renewed his call for U.S. Attorney Joseph E. diGenova to state publicly that federal authorities have not bugged him since the mayor took office in 1979. However, in the interview, Barry said he would be satisfied if diGenova would simply state that no such bugging has occurred since diGenova became U.S. attorney in December 1983.

An FBI spokesman declined to comment yesterday. DiGenova's office has declined to comment on Barry's challenge, referring reporters to diGenova's statement last week asserting that federal authorities had not wiretapped Barry or his office during the period that Dockery said he made the sweeps. Dockery had said that the sweeps indicated with "90 percent" certainty that some type of bugging of Barry's telephones and home had taken place.

Barry has offered no specific information to support his contentions last week that he has been bugged by diGenova's office. No listening devices have been found and Barry said again yesterday that he kept no records of the sweeps by Dockery.

Other electronics experts have said that without finding bugging devices, it is difficult to determine whether such eavesdropping has occurred. They have questioned the reliability of Dockery's tests.

Barry said last week that he checked for possible bugging at the suggestion of a friend in 1984 when he was active in the presidential campaign of Jesse L. Jackson. Yesterday, at his news conference, Barry said he he initiated the sweeps after being tipped by an anonymous caller. Later, Barry said he must have misspoken last week.

Barry has said he was outraged to discover that his telephones may have been tapped and his privacy invaded in his home. But he also has said it does not bother him because he is doing nothing wrong.

During the news conference, Barry answered several inquiries about the bugging, then abruptly cut off the questions, saying he wanted to get on to other subjects.

Dockery was arrested on Friday in the District on charges of writing worthless checks for more than $10,000 at a telephone store in Montgomery County. He was released on bond Saturday after appearing in D.C. Superior Court.