New Hampshire Secretary of State David Scanlan should play the lottery.

Last Friday, he predicted 322,000 votes would be cast in the First in the Nation Republican primary. Wednesday night, he released the final tally.

323,166. He missed it by just 0.36 percent.

“Picking the turnout number is part science, part art, but mostly luck,” Scanlan told NHJournal.

Former President Donald Trump received 175,308 votes (54 percent), while former U.N. Ambassador Nikki Haley got 139,729 (43 percent). Though they had dropped out of the race, both former N.J. Gov. Chris Christie (1,488) and Florida Gov. Ron DeSantis (2,223) still received votes.

And while the write-in ballots on the Democratic side have gotten the most attention, more than 1,100 write-in ballots were cast in the GOP primary, 497 of them for President Joe Biden. Robert F. Kennedy, Jr. got 203 write-in Republican votes, and 34 GOP voters participated in the “Cease Fire” write-in effort backed by Democrat former Executive Councilor Andru Volinksy.

Volinsky’s anti-Israel organization urged Granite Staters to write in the phrase “Cease Fire” as a protest against the Biden administration’s support for Israel’s war against the Hamas terrorist organization.

In the Democratic primary, 121,152 total votes were cast; the vast majority of them (77,061) were write-ins for Joe Biden. That gave him 64 percent of the total votes cast, through an effort backed by a six-figure ad campaign urging Democrats to ignore the fact that Biden refused to participate in the Granite State primary and write him in.

Minnesota Congressman Dean Phillips (D) received 23,977 votes (20 percent) and says that, like Haley, he’s going to stay in the race.

Marianne Williamson, the best-selling author and peace activist who also ran in 2020, received just 4,938 votes — barely edging out the 4,695 write-in ballots Nikki Haley received from Democrats.

She wasn’t the only Republican to get Democratic write-in votes. Trump got 2,055, and two Democrats wrote in far-right culture warrior Vivek Ramaswamy.

Haley used her 43 percent finish to argue that she’s building strength from state to state (she got 19 percent of the vote in Iowa) and was stumping in South Carolina Wednesday.

Trump has lashed out at Haley over her decision to stay in the race, issuing a statement Wednesday threatening any Republican who supports her campaign.

“Anybody that makes a ‘Contribution’ to Birdbrain [Trump’s nickname for Haley], from this moment forth, will be permanently barred from the MAGA camp. We don’t want them, and will not accept them, because we Put America First, and ALWAYS WILL!” (Emphasis original.)