With just six weeks to go until Election Day, younger voters are shunning the two major political parties on a scale not seen since Ross Perot’s third-party bid for the presidency in 1992, a striking swing in public opinion that is slicing into Hillary Clinton’s thin margin for error.

Though young people are notoriously fickle about showing up at the polls, they are a growing and potentially pivotal bloc of voters. Millennials now outnumber baby boomers as the country’s largest generation. And while they may be more predisposed than other groups to vote Democratic, they are not moving toward the party and its nominee as quickly and predictably as they have in past elections.

The Clinton campaign held several events on Wednesday aimed at millennials, underscoring the urgency with which she and her team are working to lock down the group: about 75 million Americans. Mrs. Clinton traveled to New Hampshire with her former primary rival, Senator Bernie Sanders of Vermont, for a rally with college students.

The first lady, Michelle Obama, spent the day visiting campuses in Philadelphia and Pittsburgh. She had blunt words for anyone thinking about voting for a third party. “If you vote for someone other than Hillary, or if you don’t vote at all,” she said, “then you are helping to elect Hillary’s opponent.”