“Great news! Tonight, we broke the all-time attendance record previously held by Elton John at #SNHUArena in Manchester, New Hampshire!” Mr. Trump tweeted.

In the days that followed, Mr. Trump repeatedly asked aides if his victory over Mr. John was capturing headlines. It wasn’t. Though aides were not surprised as they did not view the accomplishment as a major story, to the president, it represented an emotional wound — his belief that he is perpetually demeaned and never receives his due, according to people close to him.

It was not the first time that Mr. Trump focused on topping the attendance records of Mr. John, who was knighted by Queen Elizabeth II in 1998.

In Montana last summer, Mr. Trump asserted he had broken Mr. John’s record at the arena where he appeared — and again complained that he was not getting credit.

“I have broken more Elton John records. He seems to have a lot of records,” Mr. Trump said. “And I, by the way, I don’t have a musical instrument. I don’t have a guitar or an organ. No organ. Elton has an organ. And lots of other people helping. No, we’ve broken a lot of records. We’ve broken virtually every record.”

Senator Kevin Cramer of North Dakota said in an interview that that year, Mr. Trump had pressed him on how big Mr. John’s crowd had been at a concert in Fargo — and was laser-focused on beating those numbers.

During the campaign in 2016, Mr. Trump would blast Mr. John’s music aboard his private airplane so loudly that people could not sleep, according to former campaign aides. And at the time, Mr. Trump’s advisers pointed to his public celebration of Mr. John’s civil union with his partner, David Furnish, in 2005, as evidence of his tolerance toward gay rights. (That support, expressed on Mr. Trump’s now-defunct blog, has been deleted, and the president’s administration has established a track record of repeatedly curtailing rights for lesbian, gay, bisexual and transgender people, targeting transgender people in particular).