The confidence gap is driven entirely by asymmetric partisanship, powered by a surge in Republican sentiment. When Mr. Obama was in office, surveys consistently showed that Democrats felt better about the economy than Republicans. When Mr. Trump was elected, the pattern reversed almost overnight, though the surge in Republican optimism was larger than the drop-off among Democrats.

Masha Krupenkin, a Boston College political scientist, said Republicans show bigger swings in economic confidence, and exhibit a similar pattern in surveys that ask about trust in government, depending on which party controls the White House, compared with Democrats.

The Times survey showed Democrats were less optimistic about the economy and less willing to credit Mr. Trump for it than Republicans were. Confidence among independent voters has fallen to a level between that of Democrats and Republicans, but closer to Democrats’, during Mr. Trump’s term. (Optimism among independents surged in January, but came back to earth in February, according to the Times survey.)

Douglas Prasher, a Democratic voter in Prescott Valley, Ariz., said he didn’t buy claims that the economy was doing well — and he didn’t think Mr. Trump deserved credit if it was. Mr. Prasher, 68, recently retired to Arizona from San Diego, which he said had become unaffordable because of sky-high housing costs. His new home state is cheaper, but he has still had to take on a part-time job to make ends meet. He carries hundreds of thousands of dollars in student loan debt from helping his daughters go to college.

“As far as I’m concerned, people are suffering,” Mr. Prasher said. The supposedly strong economy, he said, “seems to only help the wealthy, which we’re not in that category.”