Perhaps the most important reason Donald Trump is president is because nearly two-thirds of American voters thought the country was moving in the wrong direction. Trump played to that dissatisfaction and disaffection, shouting at rallies that the United States is “a hellhole.” Progressives have matched conservative anger with a powerful popular uprising of their own. The Virginia governor’s race — a crucial 2017 contest — offers a contrast, and an opening for an anti-Trump. The man best positioned to do that is Lt. Gov. Ralph Northam.

Unlike the vitriol defining national politics, most Virginians are — I hope you’re sitting down for this — happy. They say the state is moving in the right direction. And they like their governor. Democrat Terry McAuliffe has focused on jobs, and has been a self-described “brick wall” standing against divisive social issues, such as the so-called bathroom bill that has hog-tied neighboring North Carolina.

How does the GOP run in a commonwealth in which every statewide elected official is a Democrat, and voters believe those Democrats have things moving in the right direction? Virginia Republicans will choose between former Republican National Committee chair Ed Gillespie — a classic establishment Republican who served in the George W. Bush White House — and Prince William Board of County Supervisors Chairman Corey Stewart, a Confederate-flag-waving former Virginia campaign chair for Trump. Either will have a tough row to hoe, carrying the stench of Trump.

Democrats, too, face a primary choice. Former congressman Tom Perriello is an impressive, intelligent, earnest one-termer who lost his first reelection fight despite appeals to the National Rifle Association and pro-life activists. He has been endorsed on The Post’s op-ed page by dear friend and former boss in the Clinton White House, John Podesta. John has been my friend for decades, but from my side of the Potomac (I live in Northern Virginia) I think Northam is the better option for Democrats. (Full disclosure: My son is a regional political director for Northam’s campaign.)

Northam, a former Army officer and pediatric neurologist, represented the state’s conservative Eastern Shore in the state senate. He won there even after taking on the gun lobby in the wake of the Virginia Tech massacre, and has always been a stalwart defender of a woman’s right to choose.

Northam has the enthusiastic support of McAuliffe, as well as Virginia’s two popular senators, Mark Warner and Tim Kaine. He represents a progressive agenda that refuses to trim its sails, while his courtly, civil, bedside manner is a welcome contrast to the vitriol spewing out of the White House. As a rural Virginian and a doctor, he is well-situated to make the case to expand Medicaid, which would benefit rural Virginians especially. His environmental pitch is rooted in his love of the Chesapeake Bay, and his commitment to his fellow veterans has the credibility that comes from being a graduate of the Virginia Military Institute and having worn the uniform with pride.

In fact, Northam strikes me as the anti-Trump: modest, decent, humble, thoughtful — and a person of outstanding character. In addition to his everyday work as a pediatrician, he has for the past 18 years volunteered to care for terminally ill children in a pediatric hospice. He has continued this unpaid, heartbreaking labor of love as lieutenant governor, even while the legislature is in session.

Voting a year after the presidential election, Virginians usually swing to the party that has just lost the White House. Northam, I believe, offers Democrats their best chance for continuing that trend, and the right balance of continuity and change: continuing the pragmatic progressive agenda of McAuliffe, Warner and Kaine, while serving as the anti-Trump both in substance and in style. Sam Rayburn used to say, “any jackass can kick down a barn, but it takes a good carpenter to build one.” Washington has been overrun with jackasses. I believe that on the other side of the Potomac, voters will be looking for a carpenter like Ralph Northam.