During the rally, supporters gleefully booed at every dig at the so-called fake news, laughing and jeering as Mr. Trump recalled conversations with his wife, Melania, about anticipating positive coverage, only to be disappointed by what he deemed to be critical headlines.

“They can make anything bad because they are the fake, fake disgusting news,” the president said.

And he was prepared to list his grievances.

He interrupted a 10-minute recollection of his 2016 election night victory to complain that the news networks had intentionally delayed results, claiming that Pennsylvania had been deprived of its chance to take credit for clinching his Electoral College victory.

He found fault with the coverage of his meeting with Kim Jong-un, the leader of North Korea, after which Mr. Trump claimed that the North had ceased nuclear testing and had finally returned the remains of American soldiers killed during the Korean War — all thanks to his diplomacy, he said. (Despite his assurances, the country has continued testing, and it is unclear if and how the remains were properly identified.)

He mocked criticism of his passive demeanor in his meeting with President Vladimir V. Putin of Russia in Helsinki, Finland, telling the crowd that a good relationship with the Russian president was to be celebrated. (“That’s a good thing folks, not a bad thing,” he said to applause.)