Donald Trump has closed the gap with Hillary Clinton in many national polls — with some putting him in the lead — but he faces a far tougher challenge in the Electoral College, analysts said Wednesday.

According to the RealClearPolitics average of national polls, Clinton was ahead of the GOP nominee by a scant 1.7 percentage points, 47 to 45.3 percent, down from a 7.1 point lead on Oct. 18 before FBI Director James Comey’s email bombshell on Friday.

But when it comes to the Electoral College, the former first lady maintains a larger advantage — with the University of Virginia’s Center for Politics projecting 293 votes for her and 173 for Trump. It takes 270 to win.

“We still see Clinton winning. You can reasonably argue about the size of the victory — and there are many contrary indications — but she’s still the clear favorite,” Professor Larry Sabato, the center’s director, told The Post.

The RealClearPolitics projection showed a narrower race, with Clinton carrying 226 electoral votes to Trump’s 180 and 132 toss-ups.

The electoral vote is far more important than the popular vote, as proven in 2000, when Al Gore got more individual votes, but lost the presidency, with help from the Supreme Court, to George W. Bush.

Once Florida was declared in Bush’s column, he ended up with 271 electoral votes — but only 47.9 percent of the popular vote to Gore’s 48.4 percent.

The Electoral College has 538 “electors,” and the number from each state equals the number of members in its congressional delegation, with one for each member of the House plus two for the two US senators. The District of Columbia has three electoral votes.

Matt Hale, a professor of political science at Seton Hall University, described different winning scenarios for each candidate.

“Clinton has a much easier path to get to 270 electoral votes than Trump does. Based on some models, Hillary wins if she wins Florida or Ohio or North Carolina or Georgia,” he said.

“Trump wins if he wins Florida and Ohio and North Carolina and Georgia and Wisconsin and Michigan and New Hampshire and Arizona and Nevada” — runs the table in those key states. In other words, a much tougher task, he added.

Meanwhile, Moody’s Analytics presidential election model, which has correctly predicted the outcome of every presidential election since 1980, was updated for the final time before Tuesday’s election, and it shows Clinton winning with 332 electoral votes.