It’s the end of an era.

Trivia titan James Holzhauer lost “Jeopardy!” on Monday night, bringing his epic 32-game run to a close.

A 27-year-old librarian from Chicago, Emma Boettcher, bested Holzhauer, a 34-year-old professional sports gambler based in Las Vegas.

Holzhauer held an early lead, but Boettcher overtook him during the second half of the game after betting all of the $7,600 she’d earned so far on a Daily Double in a category about capitals that begin with “A.”

After all three contestants answered Final Jeopardy correctly, she toppled Holzhauer with a score of $46,801 to $24,799.

Even Alex Trebek himself was floored: “Oh gosh! What a payday,” exclaimed the legendary host, who is battling pancreatic cancer, as Holzhauer gave Boettcher a high-five. “What a game! Oh my gosh!”

A minute-long video of Final Jeopardy showing Holzhauer’s defeat made the social media rounds over the weekend. Monday night’s episode aired first on the CBS affiliate in Montgomery, Ala., on Monday at 9:30 a.m. (its regular time), confirming the clip was true.

After Friday’s match, Holzhauer was just $58,484 away from beating Ken Jennings’ 2004 regular-season haul of $2,520,700 after 74 games. But the payout Holzhauer is taking home isn’t too shabby: a before-tax total of $2,464,216, which includes the $2,000 he netted Monday night for coming in second.

Holzhauer told sports betting site the Action Network in an interview published Monday afternoon that “Jeopardy!” wrote him a check this week in order to take photos; contestants usually have to wait about four months after their last episode airs to get paid.

Boettcher, an English major at Princeton, seems to be a “Jeopardy!” savant cut from the same cloth as Holzhauer. While Holzhauer, a math major at the University of Illinois, practiced buzzer skills with a mechanical pencil, Boettcher fashioned her own out of a pen to prepare. She played along with the game show “religiously” for years.

“I lost to a really top-level competitor,” Holzhauer told the Times in an exclusive interview. “She played a perfect game. And that was what it took to beat me.”

Monday night’s episode was taped on March 12; Holzhauer made his “Jeopardy!” debut on April 4. “Jeopardy!” ratings have been the highest in 14 years, per Nielsen.

“Nobody likes to lose,” said Holzhauer. “But I’m very proud of how I did, and I really exceeded my own expectations for the show. So I don’t feel bad about it.”

Some critics have laughed at Holzhauer’s seemingly paltry Final Jeopardy wager Monday night: $1,399. But it was the right move from a betting perspective. Holzhauer went into Final Jeopardy with $23,400 to Boettcher’s $26,600. He had one option if he wanted to give himself the best chance of winning: Take the low, which is gambling parlance for essentially betting that your opponent will lose.

Since Boettcher had more money than him, he couldn’t count on beating her if they both answered the question correctly — because double her total would still trump double his. Assuming that she would bet enough to beat him even he doubled his own winnings — which is, in fact, what she bet — Holzhauer put up a sum that would enable him to win even if they were both wrong. Had that come to pass, Boettcher, with her bet of $20,201, would have wound up with $6,399; Holzhauer, meanwhile, with his wager of $1,399, would have had a winning $22,001. (He’d also calculated what he needed to bet in order to cover — by $1 — the third-place contestant, Jay Sexton, who had $11,000 going into Final Jeopardy and could have had as much as $22,000 if he’d wagered it all.)

“Sometimes taking the low is your only good option,” professional gambler Joanna Wlodawer tells The Post. “He evaluated all of his options and made the right play” – even though they both answered correctly and he lost the game.

Trebek did not seem to agree. Upon seeing Holzhauer betting in the four digits, Trebek playfully needled, “His wager, a modest one for the first time.” Responding to online allegations that Holzhauer threw the game and to Trebek’s bit of snark, Wlodawer says, “On both counts, it’s crazy. The disses are unwarranted. Do you think he all of a sudden made a bad decision? Or do you think he just decided that he had enough money and didn’t want to play anymore? Anyone who says he bet poorly or lost on purpose, that person knows nothing about strategy.”

“I knew I could only win if Emma missed Final Jeopardy, as there was no way she wouldn’t bet to cover my all-in bet,” Holzhauer told the Action Network. “So my only concern was getting overtaken by third place, and I bet just enough to make sure of locking him out. Betting big would have looked good for the cameras, but now I turn my straight bet (Emma misses) into a parlay (Emma misses and I get it right).”

After a break, Holzhauer plans to go back to his job as a professional sports gambler around the start of football season in September. He has expressed throughout his winning streak that he’d be interested in doing statistical analysis (aka sabermetrics) for a baseball team. But Holzhauer did tell the Action Network that while “interest in sports remains strong … I love Vegas and I’m in no hurry to leave.”

He will go down in the record books as an almost unbeatable player. Over his 32 straight games, he got 97% of all answers correct; he answered 32 of 33 Final Jeopardy clues correctly.

In fact, Syracuse University sports analytics professors Shane Sanders and Justin Ehrlich crunched the numbers for USA Today in a story published Monday and found that, at the start of any given match, there was a 99.3% chance that Holzhauer would win. They also projected Holzhauer would win 98 more games before losing.

“Timing is everything,” Holzhahuer tweeted drily in response to the USA Today piece.

Holzhauer is the third-highest-earning player of all time. Brad Rutter, who has won several tournaments on top of his regular-season play, has bragging rights with $4,603,435, according to The Final Wager’s sortable leaderboard, followed by Jennings with $2,520,700. Holzhauer is on Jennings’ tail with his $2,462,216. To put Holzhauer’s run in perspective, the fourth-highest-earning player is David Madden, who didn’t even crack half a million with a mere $430,400 total.

A host of interesting facts about Holzhauer emerged during his run. His brother Ian told The Post the mental math prodigy hated having to wear uncomfortable formal shoes during the tapings and that his “last formal job was at Brown’s Chicken serving fried chicken at 16.” Holzhauer moved to Las Vegas after college to live with four other gamblers; now he’s married and with wife, Melissa, has a 4-year-old daughter, Natasha.

Inevitably, America will see Holzhauer again — at the next Tournament of Champions or another “Jeopardy!” special event where past winners are invited to return.

In fact, Jennings told the Times a matchup between him and Holzhauer down the line was “almost certain.” He publicly marveled that Holzhauer’s streak as “astounding,” in part because he racked up such an astronomical sum in less than half the number games it took Jennings.

At least Holzhauer’s daughter has a reason to celebrate.

“My kid cried about the possibility of her dad losing, so I told her we could have a party the day after it inevitably happens,” he tweeted late Sunday night. “Now she cries when I win.”

It’s time to party, kid.