The day after, a gleeful Mr. Trump called Mr. Dowd. “I slept like a rock,” the president said. “I love that letter.”

By March, little progress had been made with Mr. Mueller. On March 5, Mr. Dowd met with the special counsel and one of his deputies and explained why he was trying to keep Mr. Trump away from them.

“I’m not going to sit there and let him look like an idiot,” he said.

Later that month, Mr. Dowd told Mr. Trump why he should avoid an interview: “It’s either that or an orange jumpsuit.”

Mr. Mueller engaged in lively conversations for months with Mr. Trump’s lawyers.

The book offers the first extensive look at dialogue between Mr. Mueller and those involved in the Russia investigation. Mr. Woodward recounted Mr. Dowd’s zigzagging relationship with the special counsel’s office, and the lengths he went to to build a rapport with Mr. Mueller in the heat of negotiations over an interview with Mr. Trump. Mr. Dowd fluctuated between credulity and outrage, at one point telling Mr. Trump after an especially trying meeting with Mr. Mueller that the president may have been right about the special counsel all along.

Mr. Woodward wrote that Mr. Dowd would tell Mr. Mueller that the president did not have time for the inquiry while he was juggling the responsibilities of his new job.

“I’m very sensitive to that,” Mr. Mueller reportedly responded. “I’m doing the best I can.”

Still, Mr. Mueller at one point told Mr. Dowd that he could acquire a grand jury subpoena, which Mr. Dowd interpreted as a threat.

“I’m not trying to threaten you,” Mr. Mueller reportedly told Mr. Dowd. “I’m just thinking of the possibilities here.”