BILLINGS, Mont. — A multimillionaire with an East Coast education stepped off a campaign jet here recently and took jabs at reporters, pledged to “drain the swamp” and drowned his opponent in insults and punch lines.

The candidate was Greg Gianforte, a Republican running for Congress in Montana’s closely watched special election. But if it wasn’t immediately obvious where he took his political inspiration, Mr. Gianforte spelled it out in five gold-plated letters.

“The first thing we’re going to do is we’re going to work with Donald Trump,” Mr. Gianforte said.

At a time when President Trump is mired in the most heated scandal of his short administration — with questions swirling around a Russia investigation and the firing of James B. Comey as director of the F.B.I. — Mr. Gianforte is barreling toward a special election with the full-throated endorsement of the president. And voting day, which is May 25, will be watched nationally for any signs that Mr. Trump, his tactics or his style of politics are wearing thin with voters who overwhelmingly supported him in November.

Could Mr. Trump’s brash, in-your-face approach work for another politician? Or have the president’s stumbles clouded supporters’ views of him and anyone who takes Mr. Trump as a role model?

While candidates in recent special elections in Kansas and Georgia have played down connections to Mr. Trump, Mr. Gianforte has hewed particularly close to the president’s narrative: He promotes his outsider status (he has never held office) and his business acumen (his software empire, RightNow Technologies, started in a basement), and takes aim at sanctuary states and “the liberal elite” whenever he can. He’s crisscrossed the state with the president’s son, Donald Jr., and stumped with Vice President Mike Pence and Interior Secretary Ryan Zinke.

Mr. Gianforte’s critics are already going after his supposed Russia ties — he holds about $250,000 in funds that include shares in Russian companies.

All that is missing, it seems, is the provocative Twitter habit.

The similarities have struck a chord with Montanans. “I’m voting for Greg. Period,” Nancy Dehler, 69, said in a recent interview. “He’s outspoken. He’s not a politician. And he’s a successful businessman.” She characterized her endorsement of Mr. Gianforte as a push for Mr. Trump’s agenda, including less spending on welfare, a key issue for her. As for the turmoil surrounding the president, she said, “the media is doing everything they can do to lie about him.”

The race has pitted Mr. Gianforte, 56, who moved to Bozeman from New Jersey in the 1990s, against Rob Quist, 69, a country music artist who has spent nearly 50 years singing about the state’s big sky and snowy peaks. They are running to fill the at-large seat vacated by Mr. Zinke. Because the state has just one million people, the winner will be Montana’s only representative in Congress. The stakes, as Mr. Gianforte put it in a recent interview, are “huge.”

Mr. Gianforte billed…