MISSOULA, Mont. — President Trump praised a Republican candidate’s assault last year on a reporter and fumed over his Democratic opponents here on Thursday night in a freewheeling rally meant to mobilize his base’s support in the coming midterm elections.

In urging the crowd to vote for Representative Greg Gianforte, who is running for re-election and who was sentenced to anger management classes and community service for assaulting a reporter last spring, Mr. Trump jokingly warned the crowd to “never wrestle him.”

“I had heard he body-slammed a reporter,” Mr. Trump said, noting that he was initially concerned that Mr. Gianforte would lose in a special election last May. “I said, ‘Wait a minute. I know Montana pretty well; I think it might help him.’ And it did.”

“Anybody that can do a body-slam,” the president added, “that’s my kind of guy.”

Mr. Trump made no mention at the rally of Jamal Khashoggi, a dissident Saudi journalist and columnist for The Washington Post, who disappeared this month after visiting the Saudi Consulate in Istanbul. United States intelligence officials say Mr. Khashoggi was most likely killed by Saudi officials.