LEESBURG, Va. — Tom Perriello acknowledges that he is running the most progressive campaign for governor in modern Virginia history. He speaks stirringly about undocumented immigrants who fear deportation and transgender teenagers who face a “bullier in chief,” while vowing to put “community policing ahead of paramilitary policing” and to confront the state’s utility giant.

At a Loudoun County Democrats meeting last week in this booming Washington exurb, it was easy to see why leading liberals such as Senators Bernie Sanders and Elizabeth Warren have endorsed the upstart candidate.

Yet while Mr. Perriello’s call to arms drew an enthusiastic ovation, it did not sway Matt Leslie, who long ago committed to Lt. Gov. Ralph Northam, the other Democrat in the race. Mr. Northam came to Loudoun County two years ago to raise money for Mr. Leslie’s boss, a member of the county board.

“He’s going to have to pull out some new voters if he’s going to catch up with the lead Northam has,” Mr. Leslie said.

The closely contested primary, which will be decided on June 13, has emerged as the most significant intraparty Democratic contest yet in the Trump era. Mr. Perriello, a one-term House member who was turned out in 2010, is testing whether party activists in a tradition-bound state that typically rewards political moderation will respond to Mr. Trump’s presidency by rallying to the candidate mounting the most unapologetically liberal and Trump-focused campaign.

The race has assumed importance beyond Virginia’s borders because it will offer broader insights into the nature of politics today: How much, or how little, do traditional markers of strength, like endorsements, résumés and fund-raising, even matter in statewide elections?

“If we can show that they have unleashed a new political energy in key swing states like Virginia, some of those Republicans in Congress will start to distance themselves from the hate and bigotry and, frankly, incompetence of the Trump administration,” Mr. Perriello implored the Loudoun Democrats.

New Jersey is the only other state electing a governor this year, but it is Virginia, which has swung toward Democrats in presidential races yet remains competitive down the ballot, that will be looked to as an early barometer for how voters respond to the political scene across the Potomac River.

The winner of the Democratic contest will most likely face Ed Gillespie, a former Republican National Committee chair and Washington lobbyist, in the general election.

By the traditional rules of primaries, Mr. Northam should not be vulnerable to a challenger. He has the endorsement of every Democratic statewide officeholder and state legislator in Virginia, as well as powerful interest groups like Naral Pro-Choice America and the Virginia Education Association. He has raised more money, and he has effectively been running for governor since being sworn in as lieutenant governor four years ago, appearing at 180 events for other Democrats in and picking up countless chits along the way.

And since state law bans the sitting governor, currently the Democrat Terry McAuliffe, from seeking a second consecutive term, Mr. Northam is effectively the incumbent.

But Mr. Perriello, who has found two-thirds of his campaign financing from out-of-state, is betting that his party is hungry for something more than continuity in the Trump era.

“When Democrats run on change, we win,” he said. “When we run on the status quo, we generally lose.”

A former state senator, Mr. Northam, 57, is not running as a moderate alternative to Mr. Perriello, 42, but as a consensus-oriented insider who knows his way around Richmond, the state capital.

“The next governor has to hit the ground running, they need to have an agenda of what they want to get done, and they’ve got to have relationships with legislators and know how to get things done,” Mr. Northam told a group of progressive activists gathered near Mt. Vernon last week.

“This is an election for the next governor of Virginia,” he continued in response to question about his opponent’s out-of-state supporters. “It’s not about Vermont.”

Mr. Sanders’s decision to wade in for Mr. Perriello not only offered a contrast to the deep establishment support Mr. Northam enjoys, it also prompted suggestions that the clash was evolving into a replay of last year’s Democratic presidential primary.

But this contest may better resemble an earlier presidential nomination fight: the epic contest between Hillary Clinton and Barack Obama.

“The closest comparison is the ’08 race in terms of a candidate with institutional support versus the insurgent,” said Jesse Ferguson, a national Democratic strategist reared in Richmond.

Mr. Perriello’s backers, not surprisingly given the 2008 results, welcome the analogy. The one-time congressman lost his seat largely for embracing the Obama agenda, and his comeback effort bears echoes of the former president whose State Department he worked for in recent years. Mr. Perriello calls for a new politics beyond traditional left-and-right lines and dismisses what he calls a lazy “’90s mind-set” about what is and is not possible. The primary, he said, is turning on “whether we need small change or big change.”

“We’ve actually been talking about the issues of automation and the monopolization of the economy,” Mr. Perriello said in an interview, “and the number of times the media covers that has been next to zero because it’s a new set of issues they don’t understand.”

But Mr. Obama ultimately bested Mrs. Clinton because, unlike anti-establishment candidates in other Democratic primaries, including Senator Sanders, he was able to forge a coalition that linked educated white progressives and black voters.

Mr. Perriello has yet to prove that he can do the same, and the biggest impediment to his doing so has been Mr. Obama himself. While he stands by his praise of the former lawmaker from a 2010 rally, video that Mr. Perriello has made into an ad, Mr. Obama does not want to create a precedent of engaging in primaries and has denied Mr. Perriello a coveted endorsement.

In a sign of how potent a force Mr. Obama remains with African-Americans, and the degree to which he could have upended the race, Mr. Northam telephoned former Attorney General Eric H. Holder Jr. to ensure the former president’s neutrality, according to three Democrats briefed on the call who spoke on the condition of anonymity.

Acknowledging the conversation, Mr. Northam said he told Mr. Holder, a close friend of the former president, that he had been the second elected official in Virginia (after then-Gov. Tim Kaine) to endorse Mr. Obama in the run-up to the 2008 primary.

“I just reminded Attorney General Holder that I had been very loyal, as has my wife, too, to President Obama,” Mr. Northam said. “That message got back to him.”

Without Mr. Obama’s backing, Mr. Perriello has scrambled to appeal to African-Americans, who could make up about a third of the primary vote, with a robust economic and criminal justice agenda. He is wagering that the “institutional gatekeepers” in Virginia’s black community have no more clout than those African-American leaders who backed Mrs. Clinton over Mr. Obama in 2008.

But Mr. Perriello allows that he is no Barack Obama, and he has bowed to some of those same gatekeepers.

He appeared last month at a black church in the suburbs of Richmond, a crucial battleground, and surprised the pastor by staying for the entire service. Tyrone E. Nelson, the minister at Sixth Mount Zion Baptist, had already endorsed Mr. Northam.

“In central Virginia, as it relates to African-Americans, they just don’t really know Tom,” Mr. Nelson said.

That is the other key way this race differs from a presidential primary: Statewide primaries can turn on relationships or connections to the candidates themselves.

This is particularly the case in an odd-year primary held in June, when colleges have emptied out for the summer and many voters are on vacation. Mr. Perriello is cognizant of his challenge in a friends-and-neighbors primary. He is hoping to broaden the electorate beyond the 319,000 voters who cast ballots in 2009, the last time Virginia Democrats had a contested campaign for governor.

“When we started the race, we thought if we changed the electorate we would win, with the old electorate we lose,” Mr. Perriello said. “Now if we change the electorate we definitely win, and with the old electorate we’re at about 50-50.”