The left flank of the Democratic Party has long eyed next week’s House primaries in New York as a prime opportunity to put an unabashedly liberal imprint on Congress, targeting several seats in one of the country’s most Democratic states to shift the party further in its direction.

But as the June 23 primary approaches, many liberal activists are scrambling to avoid a different outcome: A pair of relatively moderate candidates could emerge and end up being elected later this year in overwhelmingly blue districts — thus, they warn, squandering the chance to send new liberal standard-bearers to Washington.

The fears persist despite increasing optimism on the left that middle school principal Jamaal Bowman could unseat veteran Rep. Eliot L. Engel on June 23, with some openly warning of a one-step-forward, two-steps-back scenario.

The anxiety is especially acute in the 15th congressional district — a South Bronx seat frequently rated as the most Democratic in the nation — where a veteran politician with a long history of anti-gay and antiabortion rhetoric has put many party officials and activists on red alert.

Many fear that the candidate, New York City Council member and former state senator Rubén Díaz Sr., could represent a persistent thorn in the side of House Speaker Nancy Pelosi (D-Calif.) and other national Democrats — not only for his taste for controversy, but also his willingness to speak fondly of President Trump, Sen. Ted Cruz (Tex.) and other Republican officials.

“People are finally beginning to realize what is at stake: There’s a real risk that a Trump Republican could represent the bluest congressional district in America, which would represent a profound embarrassment for the Democratic Party and progressive politics nationwide,” said Ritchie Torres, a city councilor who is running against Díaz to fill the seat being vacated by Rep. José E. Serrano.

Meanwhile, in the suburban 17th congressional district, liberal worries center on the campaign of state Sen. David Carlucci, who shares none of Díaz’s conservative social views but who spent the first seven years of his legislative career as a member of the Independent Democratic Conference — a splinter group of lawmakers elected as Democrats but who entered into a power-sharing agreement with Republicans. At times before its 2018 dissolution, the group effectively helped keep the GOP in power despite New York voters electing a majority of Democrats.

“If you can’t elect a progressive in a district like this, then you can’t elect a progressive Congress,” said Mondaire Jones, who has the backing of Sens. Bernie Sanders (I-Vt.) and Elizabeth Warren (D-Mass.), as well as Rep. Alexandria Ocasio-Cortez (D-N.Y.).

Jones said the notion of Democratic voters replacing 16-term incumbent Rep. Nita M. Lowey (D-N.Y.), a sponsor of Medicare-for-all legislation, with a more moderate candidate “is unconscionable to me, and it is freaking people out who are progressive-minded in Washington.”

In both districts, a crowded field and New York’s single-stage, no-runoff primary has raised the possibility that a nominee could emerge with 30 percent of the vote or less. Jones and Carlucci, for instance, are among a seven-candidate field that includes former Obama administration defense official Evelyn Farkas, state Assemblyman David Buchwald and self-funding former federal prosecutor Adam Schleifer.

The field is even more crowded in the 15th, with Díaz and Torres facing off against 10 candidates, including former city council speaker Melissa Mark-Viverito, state Assemblyman Michael Blake and councilman Ydanis Rodriguez.

A key player in sounding alarm bells on the left has been Data for Progress, a group led by activist Sean McElwee that conducted polls in both districts. The surveys, released earlier this month, furthered a dual objective — to raise awareness that Díaz and Carlucci were in position to win and to identify their strongest challengers.

Besides nudging influential interest groups to take sides and, in some cases, spend money, the polls also activated online communities of small-dollar liberal donors, such as Daily Kos, whose members sent more than $85,000 to Torres and $12,000 to Jones.

“It’s important for progressives to unite behind the best candidate to stop either a Carlucci or a Díaz,” said David Nir, a New Yorker and political director for Daily Kos. “The difficulty is that there are a lot of good options.”

McElwee said he believed that the threat posed by Díaz and Carlucci was “understated” by national Democratic groups and that while there have been moves to coalesce support behind Torres and Jones, respectively, they remain threats to win.

“A lot of bad things can happen, so I still think that outside groups should be keeping their foot on the gas,” he said.

Those efforts remain somewhat at cross purposes, however. In the 17th, for instance, Jones won $100,000 in backing from the political arm of the Congressional Progressive Caucus, while Farkas has significant backing from Emily’s List, the national group that exclusively supports women. Meanwhile, in the 15th, amid a flood of endorsements for Torres and an anti-Díaz campaign led by a union-backed group, Sanders endorsed democratic socialist activist Samelys Lopez, who had previously won support from Ocasio-Cortez.

Díaz, a Puerto Rico-born Pentecostal minister, has spent decades winning Bronx elections by pairing a close attention to constituent needs with conservative social views — much to the chagrin of fellow Democrats. Barely a year ago, Díaz again inflamed city politics when he declared the city council “controlled by the homosexual community” in a radio interview — sparking a firestorm in city politics.

Díaz’s campaign did not respond to several messages seeking comment. But his council office sent out a letter last week written by a longtime ally, lawyer Christopher R. Lynn, defending Díaz’s record and criticizing Torres for accusing the council member of having Trump sympathies “when his legislative record is anything but, with the two exceptions being abortion and gay marriage.”

“No one could ever accuse Díaz of not making his thoughts known or not keeping his word, despite great pressure for him to retract, or give in once he has made a promise,” Lynn wrote.

Torres appeared to consolidate support in recent weeks, winning the backing of the Congressional Hispanic Caucus’s political arm, several LGBT rights groups, and a rare stand-alone endorsement from the New York Times editorial board — which specifically called on Democrats to rally around Torres to beat Díaz.

Jones also won a Times endorsement — expected to be influential in the affluent towns of northern Westchester County — but Farkas has raised roughly as much money and has support from several pillars of the Democratic establishment. Carlucci, meanwhile, brings a decade of name recognition from his state legislative service.

In an interview Monday, Carlucci bristled at being compared to Díaz and defended his decision to join the IDC, saying the group helped win Republican support for liberal policies such as a minimum-wage hike and the legalization of same-sex marriage. Voters, he said, should rest assured that he would fully support the Democratic leadership on Capitol Hill if elected.

“I’ve never been the go-along-to-get-along politician. I’ve been the guy that has always had to deal with very difficult political situations in this district and in the state capital,” he said. “It’s easy to look back in time and say, ‘Oh, you should have done this, you should have done that.’ Well, where were you when we were getting marriage equality passed? . . . Where were you when we were raising the minimum wage, when we got paid family leave done?”

Carlucci has positioned himself as a pragmatist who would carry on Lowey’s record of bipartisan dealmaking, which made her the first woman to chair the House Appropriations Committee.

But Jones said Monday that the times demand a different kind of Democrat in a solidly blue district. A win by a more moderate Democrat, he said, “would be devastating to the prospects for change in our society.”

“We urgently need a Democratic Party that lives up to its truest ideals and fights tooth and nail for the things that we say we believe in,” Jones added. “We need more people who are not just going to be one of 435 members of the House, but who can provide transformational leadership.”