In the midst of the Democratic primary’s most contentious week to date, Sanders and Hillary Clinton will go toe-to-toe in Brooklyn.

NEW YORK — Thursday night’s Brooklyn debate is Bernie Sanders’ last chance to shake up the race in a state where he must pull off a major upset to change the dynamics of the Democratic primary.

The debate at the Brooklyn Navy Yard arrives during the most contentious week of the race. Sanders claimed Hillary Clinton was not “qualified” to be president, citing his common refrain: that her 2002 vote in favor the war in Iraq and the Wall Street donations to her super PAC raise questions about her judgment. He also attacked Bill Clinton’s record on criminal justice.

Clinton, for her part, accused Sanders of not being a Democrat and of being ill-informed about the backbone issue of his campaign: breaking up the big banks. The Democratic front-runner — who established her hefty delegate lead thanks in large part to support from African-American voters — will walk onto the debate stage fresh off an unusually tone-deaf moment: her perplexing participation in a racially charged joke on stage at a weekend event with New York City Mayor Bill de Blasio, which she has yet to fully explain.

In merely nailing down a date for the debate, the campaigns engaged in a snarky and drawn-out back-and-forth, which may be a preview of two tense hours on stage. The format of the debate is designed, insiders involved with the process told POLITICO, to allow the candidates to respond to recent attacks against each other. The focus, those insiders said, will be on national issues that resonate in New York, like policing reform and Mideast policy.

But the pressure mostly falls on Sanders, who must make a compelling case for himself and against Clinton, who is still leading in New York by double digits with less than a week before voters head to the polls. Ahead of Thursday’s debate, Clinton operatives sought to set a high bar by insisting anything short of a decisive win for Sanders on Tuesday could mark the real end of the race, even if he chooses to soldier on. “We are too late in the calendar for the Sanders campaign to successfully spin a second-place finish in New York as some kind of moral victory,” said Clinton spokesman Brian Fallon. “A loss here has the potential to be decisive in the overall nomination fight.

One major obstacle for Sanders is that the debate comes so close to Tuesday’s critical primary that local Democrats said it’s hard to see how anything short of a major revelation or gaffe can shift the trajectory of the race. And so far, Sanders has failed to move the needle in New York. His numbers have not shifted dramatically since the campaigns landed here in earnest two weeks ago — Clinton leads Sanders by 14 points, according to the latest Marist College poll, and she dominates in New York City and its suburbs, which together account for close to 70 percent of the vote.

Local Democratic operatives said Sanders attacks on Clinton’s ties to Wall Street, which may resonate elsewhere, do not appear to be sinking in with an electorate that knows her personally from her years as a senator and might not play well here on a debate stage. “New York union members know what she did after 9/11,” said Stuart Appelbaum, president of the Retail, Wholesale and Department Store Union. “She didn’t come across while she was senator here as being a cheerleader for Wall Street.”

A ringing Clinton endorsement from the New York Daily News that simultaneously eviscerated Sanders as a “fantasist who’s at passionate war with reality” also threatens to deprive the senator of much-needed momentum. The paper, read primarily by African-American and working class New Yorkers, targets exactly the voters among whom Sanders was hoping to make inroads in the five boroughs.

And Clinton’s support from progressive leaders like New York City Council Speaker Melissa Mark-Viverito and Public Advocate Letitia James — politicians elected with the backing of the progressive Working Families Party that has endorsed Sanders — have validated the former senator as she campaigns across the city. “Thursday’s debate is a chance for the 9 million New Yorkers who already twice elected Hillary Clinton to the U.S. Senate to see why she is the most qualified candidate in the race,” Mark-Viverito told POLITICO.

Despite the high stakes, Sanders operatives said they plan to approach the debate, as usual, with minimal prep — but ready to fight.

“It could be very civil, or there could be a lot of conflict,” warned Sanders’ senior strategist, Tad Devine. “It’ll be up to her to set the tone. We’re ready to do whatever the circumstances dictate. He’s very happy to answer questions and talk about issues, but if she is going to attack him, he’s not going to take it.”

Clinton hinted last week that she plans to zero in on Sanders’ perceived deficiencies, as exhibited during a recent, much-publicized sit-down with the New York Daily News that went bad. “He’s had trouble answering questions about his core issue, namely dealing with the banks,” she told reporters Monday while campaigning at an Indian restaurant in Queens. “He’s had trouble answering foreign policy questions. So I look forward to a debate that is in New York with people asking the kinds of questions that New Yorkers ask.”

Devine previewed a defense of Sanders responses in the bruising Daily News interview. “If you read the transcript, I don’t find it to be troubling at all,” he said. “His answers are completely cogent. The suggestions that he falls short are a political attack by Hillary Clinton and her allies.”

On Wednesday afternoon, Sanders huddled with his top advisers briefly to discuss debate preparations before a packed rally of 27,000 in Washington Square Park, headlined by the band Vampire Weekend, an event he had been forced to reschedule to attend the debate. “It is not just about electing a president, it is about creating a political revolution,” he told the crowd made up of many New York University students.

Clinton allies, meanwhile, comforted themselves that a solid debate performance will ensure a win in New York that will finally close any viable path to the nomination for Sanders.

“Unlike horse shoes, close is no good,” said Democratic strategist David Axelrod. “So I expect [Sanders] will be very aggressive in this debate, as he has been in his appearances. And I’m sure Secretary Clinton will respond in kind. In other words, prepare for a testy affair.”