Two people close to Mr. Trump said he had been moving toward an objection to Mr. Mueller testifying over the last few days as a counter to the call from some Democrats to impeach Mr. Barr for how he handled his own testimony last week to Congress.

But some of Mr. Trump’s advisers have warned that he risks turning Mr. Mueller into a martyred figure if he demands that he not testify. Others close to the president say he is making a mistake for a different reason in trying to restrain Mr. Mueller.

The special counsel, they say, would most likely face tough questions from Republicans about two F.B.I. officials, Lisa Page and Peter Strzok, who in text exchanges were deeply critical of Mr. Trump as they were investigating Russian interference in the election. Those questions would undercut Mr. Mueller’s investigation, those close to the president say, and allow them to paint it as a partisan attack on Mr. Trump.

Mr. Barr, during a hearing about the report before the Senate Judiciary Committee last week, was pressed on whether Mr. Mueller should be allowed to testify.

“I’ve already said publicly I have no objection to him testifying,” Mr. Barr responded.

By Sunday, the president did have an objection. “Are they looking for a redo because they hated seeing the strong NO COLLUSION conclusion?” Mr. Trump tweeted. “There was no crime, except on the other side (incredibly not covered in the Report), and NO OBSTRUCTION.”

Democrats say it is essential to hear from Mr. Mueller given the friction between the special counsel’s office and Mr. Barr over how the report has been characterized.

After Mr. Mueller delivered his report to Mr. Barr in March, the attorney general issued a four-page summary in which he said there was no finding of collusion between Mr. Trump’s campaign and Russia. But he also quoted Mr. Mueller saying he could not exonerate the president on the obstruction issue.