CHICAGO — Hedge-fund billionaire Ken Griffin lost his $50 million bet in the Illinois Republican primary for governor Tuesday after the suburban mayor he helped lift out of relative obscurity lost to a staunch conservative who benefited from Democratic advertising.

Darren Bailey, a southern Illinois farmer and state senator endorsed last weekend by former President Donald Trump, was declared the GOP winner by the Associated Press. He will face Democratic Gov. J.B. Pritzker, a billionaire and the nation’s wealthiest elected official, on November’s ballot.

The candidate Griffin bankrolled, Aurora, Ill., Mayor Richard Irvin, had trailed in polls going into Tuesday’s final day of voting.

Richard Uihlein — billionaire founder of the privately held Uline office-supply business and who rivals Griffin among the nation’s top Republican donors — backed Bailey.

The general-election race is rated as “solid Democratic” by the nonpartisan Cook Political Report. Pritzker, whose self-financing in 2018 helped set a national spending record for a governor’s race, won then with 54.5% of the vote. Democrats hold all statewide elected offices in Illinois.

Griffin’s spending helped make the race the most expensive primary contest in the U.S. so far this year. The founder of hedge-fund firm Citadel and market maker Citadel Securities won’t back Bailey in the general election, spokesman Zia Ahmed said.

An expanded version of this report appears on WSJ.com.

Also popular on WSJ.com:

Rural counties are booming, but can it last?

Elon Musk got Twitter’s data dump, next comes the hard part.