Wilmer Cueva, second from left, and Alfonso Prestia were led, handcuffed, into a Manhattan courtroom on Wednesday. The two will face charges in the death of a worker who died while working under their supervision.CreditMichael Appleton for The New York Times

With construction-related deaths and injuries on the rise, prosecutors announced on Wednesday that manslaughter and other charges were being brought against two construction managers and the companies they worked for in the April death of a worker at a Lower Manhattan building site.

Cyrus R. Vance Jr., the Manhattan district attorney, also announced the creation of a task force to help identify and prosecute corruption and fraud in the construction business. And New York City officials said an emergency phone number would be set up by the Department of Buildings for the reporting of dangerous conditions.

The worker who died, Carlos Moncayo, 22, an Ecuadorean immigrant who lived in Queens, was crushed by thousands of pounds of dirt when the walls of a site in the meatpacking district, steps from the High Line, collapsed around him on April 6.

Prosecutors said on Wednesday that the two managers — Wilmer Cueva, of Sky Materials, and Alfonso Prestia, of Harco Construction — had ignored repeated warnings for months from private inspectors that treacherous conditions existed at the site on Ninth Avenue.

City and federal regulations require that any excavations deeper than five feet must be shored up to prevent the walls from caving in. But in this case, at a site where a Restoration Hardware store will occupy the former home of the restaurant Pastis, the trenches went as deep as 14 feet and lacked any fortification, according to prosecutors, citing emails and other evidence.

On the morning Mr. Moncayo died, prosecutors said, another private inspector noticed a seven-foot-deep trench, and alerted Mr. Prestia, who was inside a trailer at street level and unable to see inside the pit. The inspector also notified Mr. Cueva, who was at the site, supervising work. But Mr. Cueva did not do anything initially, prosecutors said. Nor did Mr. Prestia.

By the time the pit reached about 13 feet, two hours later, Mr. Prestia told the workers, in English, to get out. But the workers, who spoke mainly Spanish, did not. Not long afterward, the walls collapsed, crushing Mr. Moncayo.

Two weeks ago, the Buildings Department issued stop-work orders at all sites using Harco as a contractor, and suspended its general contractor registrations “due to a pattern of risky behavior,” including numerous violations “deemed immediately hazardous to the public.”

On Wednesday, prosecutors unsealed criminal indictments stemming from the accident.

Calling Mr. Moncayo’s death “foreseeable and avoidable,” Mr. Vance announced the charges — second-degree manslaughter, criminally negligent homicide and reckless endangerment — at a news conference with Mark G. Peters, commissioner of the Department of Investigation, and officials with the New York Police Department and the federal Occupational Safety and Health Administration.

In his remarks, Mr. Peters alluded to how Mr. Moncayo’s family managed to scrape together $500 to pay for safety training for him, yet the company he worked for, “who can certainly afford to do things right, decides to cut corners, evade the law.”

Mr. Peters also noted that construction at the site was behind schedule, and that workers seemed to be in a rush.

All the defendants pleaded not guilty in State Supreme Court in Manhattan on Wednesday afternoon.

In a statement, Cesar de Castro, a lawyer for Mr. Cueva, said that while his client “mourns the loss of his co-worker Mr. Moncayo,” he “does not bear criminal responsibility.”

Jeffrey T. Schwartz, a lawyer for Mr. Prestia, called his client “a wonderful man who I am confident will be fully exonerated after all of the evidence is heard.”

Brian Gardner, a lawyer for the subcontractor, Sky Materials, said that while the company was “saddened” by the episode, “we believe it should not be the subject of a criminal prosecution.”

But the strongest comments came from Ronald P. Fischetti, a lawyer for Harco. While Mr. Moncayo’s death was “a tragic accident,” he said, his client “had nothing to do with this.” He added: “These cases are normally settled. Ours will not be. We will not accept a plea. We will not accept a fine. We will not accept anything. We intend to go to trial, and we believe we’ll be vindicated.”

Criminal liability has often been difficult to prove in construction accidents in the city. In 2012, the owner of a crane company, James F. Lomma, was acquitted of all criminal charges in connection with the collapse of a tower crane that killed two workers. But in a subsequent civil trial that ended on Monday, a jury awarded the workers’ families $96 million — $48.3 million for economic losses, and $48 million in punitive damages.

Construction-related deaths and injuries have been increasing, according to data from both the Buildings Department and Mr. Vance. In 2013, there were two construction-related deaths, Mr. Vance’s office said, and last year, there were 12. This year, there have been 10, meaning that “sadly, we’re on track this year to outpace that number,” Mr. Vance said.

A version of this article appears in print on , on Page A23 of the New York edition with the headline: Manslaughter Charges After Pit Collapse Kills Worker. Order Reprints | Today’s Paper | Subscribe