Lawyer John Flannery was held in contempt of court and fined $500 yesterday after he repeatedly asked U.S. District Judge Thomas P. Jackson to explain why he would not disqualify himself from presiding over a Mississippi man's three-year legal battle to get a patent for his "perpetual motion machine."

Flannery, a former Democratic congressional candidate in Virginia's 10th District, had asked Jackson to disqualify himself in the case because, among other things, the judge was appointed by President Reagan and the case is against a government office controlled by the administration.

"I have had just about enough of your insolence in this case," Jackson told Flannery, who insisted on discussing Jackson's refusal to disqualify himself during a hearing set to resolve another aspect of the case.

Flannery, who said he could appeal the contempt citation, often referred to Jackson's court as a "tribunal" and accused the judge of deciding in advance to hold him in contempt, saying that the presence of two U.S. marshals in the courtroom proved his point.

When Jackson said that the marshals were there for a criminal trial scheduled later, Flannery asked for the case number.

"I've heard enough," Jackson said.

Later, as Jackson perused legal documents, Flannery asked the judge if he were listening. Jackson ordered Flannery to proceed with his presentation.

The main issue at yesterday's hearing was a request by the patent office and the National Bureau of Standards to be allowed more time to test the device that investor Joseph Newman says generates more energy than it consumes.

The U.S. Court of Appeals here had allowed 30 days for the tests, a period that ended Feb. 24. Flannery said Jackson had "impounded" the device when he ordered the bureau of standards to keep it until he ruled on their request.

Jackson extended the testing period until April 15.