The judge in the Iran-Contra case said Friday he has the authority to compel President Bush and former President Reagan to testify at the trial of fired National Security Council aide Oliver North.

U.S. District Judge Gerhard Gesell made the comment at a hearing where the government argued that North's subpoenas served last month for the testimony of Bush and Reagan should be quashed.Gesell said that if it becomes necessary to have the testimony of either man at North's trial, it would be sought only as "a last resort."

"As far as the power of the court to require testimony" of Reagan or Bush, "I do not think there is any . . . question," said Gesell. He added that he thought the court's authority in such situations is "indisputable. . . . The court has the power."

Gesell said such authority must be "exercised with great deference to the office of the president" and should not be used "except as a last resort if there is no other way to resolve the issue."