They’re in a New York state of mind.

As the presidential candidates try to rack up delegates and secure their party’s nomination, all eyes will be on the Empire State’s primary on April 19.

Political experts say the campaigns are in high gear, and city voters will have a better shot at seeing how the contenders for the White House will work to address problems pertinent to the Big Apple.

“This is the first time that New York is important for both presidential selection fronts,” said Robert Shapiro a political-science professor at Columbia University. “New Yorkers have come to expect by the time that the primary comes, the ballots are locked in, but this year has shown that’s far from the case.”

Although Shapiro said Hillary Clinton, Bernie Sanders and Donald Trump have the most ties to voters with their New York connections, John Kasich and Ted Cruz could pick up the momentum with active campaigning.

There are 247 delegates up for grabs for the Democrats and 95 for the GOP.

Clinton and Sanders have been beefing up their campaigns in New York City by playing to their strengths, according to Shapiro.

The former secretary of state made appearances with Gov. Andrew Cuomo and Mayor Bill de Blasio that emphasized her political connections and experience, while a Sanders rally in Washington Square Park next week has huge support among younger voters interested in the grass roots strategy.

The biggest event by far is the April 14 Democratic debate at the Brooklyn Navy Yard, which could give New York voters the deepest insight into the candidates, according to Christina Greer, an assistant professor for political science at Fordham University.

NY1 and CNN are co-hosting the debate, and Greer predicted the moderators will put national issues in a New York frame.

“They will be able to bridge the debate to discuss New York City, New York State and national issues,” she said.

Over on the GOP side, experts say Trump has had a strong advantage, with a March 31 Quinnipiac University poll putting him ahead with 56% of Republican voters.

Shapiro said recent national polls have shown Trump has taken a dip since those remarks, however, and his opponents can take advantage by appealing to moderate GOP voters in New York.

“We’re talking an aggressive campaign here because they are in a real dogfight for delegates,” he said.

Kasich has already done some campaigning in Queens and Long Island over the past two weeks a while Cruz, who chastised Trump for his “New York values,” attended a luncheon in midtown last month.

The Texas senator also hasn’t indicated if he will join his two rivals at a Manhattan gala on April 14.

Greer said it’s hard to predict if there will be greater voter turnout because of the attention, but added that it will give the nation a nuanced look at New York politics.

“New York is always an interesting place, because we make ourselves as the center, and this primary is no different,” she said

The two parties have different and complicated mathematical ways of allocating delegates in the primary.

For Republicans, there are three delegates in each of the state’s 27 congressional districts and 14 “at-large” delegates.

If a candidate receives more than 50% of the vote in a district, he gets all three delegates. If no one garners more than 50%, then the top finisher gets two and the runner-up gets one.

The at-large delegates will be allocated in proportion with a candidate’s statewide vote, the GOP said.

Democrats have 247 delegates at stake and both candidates will compete congressional district by congressional district.

In most districts, six delegates are up for grabs, though some have five or seven, and the way they are divided gets tricky.

If a candidate wins 41.7% of the vote in a district, she or he gets at least three delegates, but if the candidate receives 58.4% or more, they get four.(with Newsday)