MANCHESTER, N.H.—When Sen. Bernie Sanders files paperwork on Thursday to run in New Hampshire’s presidential primary, a question looms: Is he a Democrat, and if not, can he run in that party’s primary?

“I am running in the Democratic primary process.” Mr. Sanders said Wednesday in an interview with The Wall Street Journal. “I am now a Democrat.” That’s a shift for Mr. Sanders, who has always run for office as an independent, and describes himself as a democratic socialist. He has repeatedly declined invitations and suggestions that he join the Democratic Party.

To run in the New Hampshire Democratic primary, one must be a “registered Democrat,” and the New Hampshire secretary of state has repeatedly refused to say whether he will certify Mr. Sanders for the ballot.

The question of Mr. Sanders’s partisan loyalties goes to a central challenge of his outsider campaign, which seeks to both shake up the established political order and succeed within it. To be disallowed a place on the ballot in the first primary state would be a major blow to his upstart candidacy against front-runner Hillary Clinton, the former secretary of state.

Mr. Sanders’s campaign aides say there is no way he could be a “registered Democrat,” even if he wanted to be, because his home state, Vermont, doesn’t register voters by party.