PHOENIX — Senator Jeff Flake, Republican of Arizona, faces political challenges from both sides in seeking re-election next year: On the left, emboldened Democrats are aggressively recruiting candidates to run against him. On the right, allies of President Trump are devising ways to punish Mr. Flake for his outspoken rejection of Mr. Trump last year.

Yet Mr. Flake, seemingly undaunted, has secretly planned an unconventional campaign kickoff that risks intensifying both threats: Working privately, and largely without the knowledge of political advisers, he has written a book that amounts to an ideological manifesto for his own version of conservatism, according to three people briefed on the manuscript who discussed it on the condition of anonymity.

All three said it was likely to inflame debate about the direction of the Republican Party.

In his writing, Mr. Flake draws a bright-line distinction between his outlook on government and a competing vision, associated with Mr. Trump, that Mr. Flake describes as nationalist and populist in nature, the people said. Mr. Flake links himself closely with Barry Goldwater, the former senator and presidential candidate from Arizona.

By leaning into his differences with the president, Mr. Flake, 54, may help ensure that his re-election race unfolds as a dramatic clash over what it means to be a Republican in the age of Trump. While many politicians write books, it is highly unusual for a senator to do so without extensively consulting advisers, particularly when the subject matter is so politically charged.