HARRISBURG, Pa. — President Trump came to a farm expo center here on Saturday to celebrate his first 100 days in office by bathing in the support of his bedrock supporters, reprising the populist themes of his campaign and savaging a familiar foe: the news media.

In a rally timed to coincide with an annual dinner of the White House press corps in Washington, which he declined to attend, Mr. Trump laced into what he referred to as “the failing New York Times,” as well as CNN and MSNBC, which he accused of incompetence and dishonesty.

“Their priorities are not my priorities, and not your priorities,” Mr. Trump said to a sea of supporters, many in familiar red “Make America Great Again” caps. “If the media’s job is to be honest and tell the truth, the media deserves a very, very big fat failing grade,” he said, adding that they were “very dishonest people.”

Mr. Trump reveled in his decision to skip the White House Correspondents’ Association dinner, describing a scene in which Hollywood stars and reporters consoled themselves in a Washington hotel ballroom, while he mixed with a better class of people in the American heartland.