As New York City’s 14 miles of public beaches open for Memorial Day weekend, the city is confronting its worst lifeguard shortage on record — something officials say is partly the result of a bitter fight between the city and the little-known but extraordinarily powerful unions that represent lifeguards.

Millions of New Yorkers are facing the prospect of partial beach closures and limited access to pools when they open next month. Parks Department officials say they currently have fewer than 500 lifeguards ready to work, roughly a third of the number they say is needed to fully staff beaches and pools.

The lifeguard shortage, which also stems from perennial issues like low salaries, a difficult qualifying test and a pandemic-induced slowdown of the lifeguard pipeline, follows months of off-season maneuvering between city officials and an obscure pair of lifeguard locals.

It is an intractable and bizarre union beef that stands out even in a city rife with them and one that has left the city — locked in collective bargaining negotiations with union officials to reach a new contract — blaming the unions for leaving key swimming spots understaffed.

The unions have a checkered past marked by sordid headlines, investigations and damning governmental reports. But they effectively control all lifeguard operations, down to determining who qualifies to work each summer.

Lifeguard coverage is critical in New York City, where beaches and pools are some of the only sources of relief for crowds of often inexperienced swimmers from sweltering neighborhoods with few public swimming resources.

An inability to swim and the dangerous surf can be a fatal combination, especially in places like the Rockaways, whose ocean beaches have dangerous rip currents that often prove deadly, particularly in the evening hours after lifeguards have gone off-duty.

Last summer, amid a nationwide lifeguard shortage, the city had 529 guards by the time public outdoor pools opened in late June, but it continued to certify lifeguards through early July to reach 900.

This year so far, there are only 480 lifeguards on hand, including 280 returning guards and 200 new recruits, parks officials said. They are scrambling to add more before the pools open.

In 2016, by comparison, the city hired nearly 1,500 lifeguards. Even in 2021, there were just over 1,000.

Parks officials said they would still be able to cover the usual eight-hour days at pools and beaches, and that they expected a late wave of returning lifeguards by early July, when summer crowds begin to peak. But swimmers can expect partial closures.

To ratchet up recruitment for this summer, parks officials had rolled out incentives like pay hikes and retention bonuses, and eased the notoriously difficult swim test. Ads were placed at public high schools, job fairs and bus shelters.

Two city officials who requested anonymity to discuss private negotiations said that their recruitment efforts had been met with obstructionist tactics by union leaders, who canceled meetings and insisted on communicating mainly by fax.

But Thea Setterbo, a spokeswoman for District Council 37, disputed the city’s negative claims.

She said lifeguard totals — reduced by the national shortage and not any labor friction — would surpass last year’s numbers within weeks, especially as returning students get certified.

“Our members have a common goal, to keep beaches staffed and the public safe,” she said. “The fact that we’ve had no drownings for eight years is a testament that our lifeguards are doing their job efficiently and maintaining the safety standards that have been in place for decades.”

The shortage has provided oxygen to perennial union critics and their standing claim that union leaders manage lifeguard operations based on favoritism and vengeance.

One of them, Janet Fash, 63, a longtime chief lifeguard in the Rockaways, said union leaders had a unique gatekeeper role that has helped keep them in power.

“It’s a shame that the union has such a stranglehold on the whole operation,” Ms. Fash said. “It’s dysfunctional. They make it so difficult for people to recertify that lifeguards get disgusted and just leave.”

Ms. Fash said: “As long as the lifeguard school is run by the union, which uses it to keep its power and as a tool of retaliation, you’re going to have shortages.”

Although the lifeguard program falls under parks jurisdiction, it has long been run almost autonomously by the leaders of the two locals: Local 461 for rank-and-file lifeguards and Local 508 for supervisors.

The locals, which are part of District Council 37, the city’s largest municipal union, wield outsize power over training, certifying and even assigning and supervising lifeguards.

Henry A. Garrido, District Council 37’s executive director, dismissed Ms. Fash’s criticism as the rantings of a disgruntled dissident.

He commended the union’s stewardship and said a major reason for the problem was that parks officials had their “worst year ever” in bringing back guards from previous years, largely because of salary issues.

By the time some contractual matters were resolved and parks officials announced lifeguard raises in early April — hourly pay for newer lifeguards increased to $21.26 from $16.10, with a $1,000 bonus for those who stay past mid-August — many returning guards had already begun looking for higher-paying jobs at beaches and pools outside the city, Mr. Garrido said.

“Before Covid, you would have 500 lifeguards returning,” he said. “This year, you have about half that.”

Asked about the unions, a parks spokeswoman would not comment on the record. But in a statement, the agency’s first deputy commissioner, Iris Rodriguez-Rosa, noted its “extensive recruitment effort” and said it was “doing everything that we can to bring on new lifeguards.”

Relations between the unions and the city have long been fraught. But parks officials’ efforts to gain more control over some aspects of the operations seem to have worsened an already rocky working relationship, leaving the city likely to fall far short of its goal to staff beaches and pools with 1,400 lifeguards.

The idea of a powerful lifeguard union might seem at odds with the place that the job holds in the public imagination: a quaint image of teenagers in swimsuits working for pocket money and time off to surf. But leaders of the city’s locals run a hard-nosed operation.

The unions have been investigated over the years by the city’s comptroller and the public advocate, who in 1994 detailed a culture of corruption based partly on a monthslong undercover investigation at the lifeguard school.

In 2021, the city’s Department of Investigation found “the structure, history, and culture of the Lifeguard Division reveals systemic dysfunction in its management and accountability.”

At the center of it all is the enigmatic union boss Peter Stein, who heads the supervisors union but holds sway over the lifeguard local as well.

Mr. Stein, who did not respond to requests for comment, has survived decades of headlines, scandals and investigations over union supervision, training and hiring.

A New York Magazine article in 2020, which the director Darren Aronofsky’s production company is now adapting into a television series, described the union’s history as a “Tammany Hall by the Sea” from which Mr. Stein ran things by a “playbook of patronage, power brokering, and intimidation.”

The city had begun trying to get union officials to come to the table to discuss the contract, including recruitment issues, in November, the two city officials said. But the union repeatedly agreed to meetings only to cancel them, finally sitting down to negotiate on Jan. 12, according to the officials. The union also created delays in recertifying lifeguards, the officials said.

The shortage has defied parks officials’ attempts to smooth out a certification process that has come under criticism.

Parks officials had sought to gain more new guards this summer by simplifying the rigorous test prospective lifeguards take to qualify for the 16-week, 40-hour training course.

The test weeds out many potential recruits largely through its 50-yard swim, which prospects historically had to finish in 35 seconds.

Faced with high failure rates — last year, of 900 applicants, only about 26 percent passed the test — and complaints from applicants, parks officials extended the acceptable time for this summer’s applicants to 45 seconds.

They also pushed for more transparency by mandating that applicants be notified of their swimming times, as opposed to merely whether they had passed or failed.

Howard Carswell, a former rescue diver with the city’s Police Department, said his 16-year-old son, a competitive swimmer, withdrew from lifeguard training this year because the officials overseeing it were surly and “generally giving the kids trying to get the certificate a hard time.”

He said his son had opted to spend the summer lifeguarding at an upstate lake for better pay.

“It wasn’t worth the aggravation,” he said. “It was just a generally depressing environment for kids that are looking to become New York City lifeguards.”