“No, not shaken,” he said. “No, not at all. Nope, not at all.”
Pressed again, Mr. Baker insisted Mr. Trump’s animus played no part in his decision.
“Which part of no? No, not at all,” he said.
Mr. Baker’s departure from the race will make it a high-profile contest between different branches of the Democratic Party, most likely pitting Ms. Healey, of the establishment’s center left, against the progressives Sonia Chang-Díaz, a state senator, Ben Downing, a former state senator. Danielle Allen, a Harvard professor who received a MacArthur genius grant for her work on race and political theory, entered the race in June.
Ms. Healey has yet to announce her candidacy but has said she would consider the race. Ms. Chang-Díaz and Mr. Downing have been campaigning for months.
Mr. Baker faced a difficult Republican primary challenge from Mr. Diehl, who was chairman of Mr. Trump’s 2016 campaign in Massachusetts. Mr. Trump endorsed Mr. Diehl in October while denouncing Mr. Baker as a “Republican in name only.”
Mr. Diehl is far less likely than Mr. Baker to retain the Massachusetts governor’s office for Republicans. Mr. Trump is highly unpopular in the state, which backed Joseph R. Biden Jr. by 33 percentage points in 2020.
One sign of Mr. Baker’s diminished level of support with rank-and-file Massachusetts Republicans came in a statement from Jim Lyons, the chairman of the Massachusetts Republican Party.
“It’s clear to me that Charlie Baker was shaken by President Trump’s endorsement of another Republican candidate,” Mr. Lyons said. “We look forward to working with President Trump as we continue to rebuild the Massachusetts Republican Party.”