By ALEXANDRA SEMENOVA

In a largely negative presidential race with front-runners who have alienated voters from their Republican and Democratic parties, third-party hopefuls are drawing well among young voters.

But the support for Libertarian nominee Gary Johnson and Green-Party candidate Jill Stein seems to be more a matter of rejecting the two major-party candidates than of approval for their agendas.

According to a mid-September Quinnipiac University poll of 960 likely voters, Johnson barely trailed Democrat Hillary Clinton among voters between the ages of 18 and 34, 31 percent to 29 percent. Trump followed at 26 percent.

Overall, the poll found Johnson was at 13 percent and Stein at 4 percent at that point in the race.

Both candidates have shown progress in the polls since their 2012 runs, in which they did not do so well. Libertarian presidential nominee Johnson was chosen by .99 percent of registered voters and Green Party candidate Stein by .36 percent, according to the official Federal Election Commission report of the 2012 presidential election.

“Although I’m still registered as a Democrat, I do disagree with a lot of what they currently stand for,” said Andrew Ironstone, a 24-year-old Florida State University student who plans to vote for Johnson in the upcoming election. “I like the Libertarians because they seem to focus on real issues while leaving their personal lives out of politics.”

But the success of Johnson and Stein among young voters has more to do with the opposition to major party nominees than with the success of the Libertarian and Green parties.

Ironstone, who said that his choice was highly influenced by his discontent with the Republican and Democratic nominees, also noted that prior to the 2016 election he had only vaguely heard of the Libertarian party. “I never thought I would be voting for their candidate,” he said.

Quinnipiac University’s poll also showed that 66 percent of Trump’s likely voters made their choice based on opposition to Clinton, while only 23 percent will vote for him because they like the Republican candidate.

Likewise, 32 percent of Clinton’s voters support her, while 54 percent are voting for the Democratic nominee just to oppose Trump, the poll showed.

“I’ve considered Stein and Johnson early on in the election season because we live in a non-swing state and I could cast a protest vote without electing Trump,” said 22-year-old Hofstra University graduate Jeff Nalotoff, who identified himself as a Democratic-Socialist. “I would vote for Johnson, mostly for his integrity, but I don’t agree with his views.

“Stein recently made a few statements that made me doubt she has the proper experience to be president,” he added.

The poll also showed that 60 percent of Clinton’s voters would like to see Gary Johnson in nationally televised debates and 83 percent of likely young voters.

In July, Gallup showed in its “Favorable Image of Hillary Clinton by Age” study that Clinton’s favorability rating has spiraled down among voters between 18 and 29, dropping from 47 percent to 31 percent over the year.

“Many Democrats support her decisions, but I feel that she is equally as financially motivated as any republican candidate is,” said Democrat Lisa Borodin, a Brooklyn College senior, who plans to vote for the Clinton in November.

“But I don’t agree that she is a complete liar,” Borodin said. “I think with time her views on gay marriage, income inequality, and women’s rights have changed. The country’s has, why not hers?”

While Borodin noted that she strongly disagrees with Clinton’s foreign policies and that she questions Clinton’s financial motives, she believes that Clinton’s flaws will not be as bad as Trump’s campaign has been so far.

“I considered voting for Jill Stein,” Borodin said, “but I feel like a third-party vote would be a wasted one.”

Erika Shatz, who also attends Brooklyn College, said she stands with Stein in the election.

“She is, in my opinion, the next best thing after Bernie,” Shatz said. “When I found out that our front-running candidates would be Trump and Clinton, I decided immediately that I wasn’t going to choose the lesser of two evils.”

But in an interview on CBS’s “Face the Nation,” Bernie Sanders urged his young supporters against voting for a third-party candidate on principle.

“Look, I am the longest-serving independent in the history of Congress,” the Vermont senator and former Democratic candidate said. “When I was younger I ran on a third party here in the state of Vermont, so I’m not here to disparage third-party candidates.”

But he said, “I think what the focus has got to be on now is understanding that this moment in history, for a presidential election, is not the time for a protest vote.”

Sima Zhukovski, a 20-year-old Brooklyn College student who said she plans to vote for Hillary Clinton, believes that voting for a third-party candidate is giving Donald Trump a better chance at winning the race.

“I’ll let you know, I’m not a fan of Hillary, but I’m voting for her because the worst thing that can happen with a Clinton presidency is that she can be a bad president or a president who didn’t do much, which this country has had a good number of,” Zhukovski said. “But a Trump presidency just makes me anxious even thinking about all the things that can go wrong.”

Photo: Libertarian Party presidential candidate Gary Johnson, left, and vice presidential candidate William Weld.