In his characteristic gruff fashion, he also tangled with the Times editorial board members over whether higher immigration levels can push down domestic wages; bridled at a comparison between Mr. Trump’s rallies and the events he said he would hold as president to pressure Republican lawmakers; and, in an exchange that with little embellishment could double as a sketch of Larry David playing Mr. Sanders on “Saturday Night Live,” explained why he had little patience for offering people birthday wishes.

Asked by the editors of a paper he reads religiously but often criticizes what he’s most likely to fare poorly at as president, Mr. Sanders initially responded, “talk to The New York Times,” drawing laughter. But then, with no prompting, he acknowledged: “I don’t tolerate bullshit terribly well.”

Mr. Sanders conceded that he’s not “good at pleasantries” and singled out one particularly grating part of retail politics.

“If you have your birthday, I’m not going to call you up to congratulate you, so you’ll love me and you’ll write nice things about me,” he said. “That’s not what I do. Never have. I take that as a little bit of a criticism, self-criticism. I have been amazed at how many people respond to, ‘Happy Birthday!’ ‘Oh Bernie, thanks so much for calling.’ It works. It’s just not my style.”

Mr. Sanders, 78, was equally candid about his exercise and diet struggles since suffering a heart attack last fall, an event that he said came as “a shock” because he had been otherwise healthy.

“I’m eating better. I’m exercising,” he began. “Well, not as much as I should. It’s hard when you’re on the campaign trail, but I am trying to do better.”

Mr. Sanders, who allowed that he had eaten ribs the previous night, said he viewed his health “as a public responsibility” and revealed that one of his daughters was prodding him toward a new fitness regimen.