PARIS—The race to become the next president of France is becoming a referendum on what it means to be French.

As voters prepare to head to the polls Sunday for the Républicains’ primary—which could ultimately determine the next president—the rhetoric at rallies and debates has increasingly focused on whether France’s secular values are compatible with its Muslim population—one of Europe’s biggest.

The election of Donald Trump has emboldened far-right presidential contender Marine Le Pen, who is campaigning against France’s socialists and conservatives on an anti-immigrant, antitrade platform similar to the U.S. president-elect’s. That message has helped keep her near the top of the polls after two years of blistering terror attacks carried out by foreign and French citizens, as well as a huge wave of migrants from the Middle East.

The cascade of events has left France’s political establishment at a crossroads: Reject Ms. Le Pen’s rhetoric or co-opt it. The divide is especially striking within the conservative Républicains. Polls show the winner would be the strongest contender—and likely win—against Ms. Le Pen in the spring election. Socialist President François Hollande’s unpopularity, meanwhile, would make him unlikely get past the first round of voting if he runs again. The outgoing president would also face his former Economy Minister Emmanuel Macron, who declared Wednesday he will run for president on a pledge to break apart France’s political system.

Bordeaux Mayor Alain Juppé, the front-runner in the race to win the conservatives’ nomination, embodies one path with talk of a “happy identity” for the French, grounded in respect for religious and ethnic diversity. He has responded to Mr. Trump’s victory by pledging to lead a broad coalition against the National Front.