The companies in charge of a Manhattan building site where laborer Carlos Moncayo died in a trench collapse last year took reckless risks to keep to a construction timetable, a prosecutor argued Thursday as the first trial stemming from the death neared a close.

“All in the name of keeping to a schedule,” prosecutor Diana Florence told Manhattan Supreme Court Justice Kirke Bartley, who is hearing the manslaughter case against Harco Construction without a jury. “The concrete truck was coming and being ready for that pour trumped everything.”

Moncayo, 22, an undocumented Ecuadorean immigrant working for Long Island excavation subcontractor Sky Materials, died in the cave-in of a 14-foot unshored trench during construction at a Restoration Hardware site on 9th Ave. Harco was the general contractor.

Closing arguments Thursday followed a 3-week trial, and Bartley indicated he would rule on Friday. Harco superintendent Alfonso Prestia, Sky, and Sky foreman Wilmer Cueva are being tried separately on the same charges — manslaughter, criminally negligent homicide and reckless endangerment.

Prosecutors contend that Harco and Sky ignored multiple warnings of unsafe excavation practices, a Harco manager resigned after complaints about the trench work were ignored, and on the day of the cave-in Cueva told an inspector that men needed to work in the unshored trench to prepare for a concrete delivery.

Harco lawyer Ron Fischetti conceded that the trench was unsafe, but argued to Bartley that Harco site supervisor Prestia was not a “high managerial agent” whose behavior could make the company guilty of manslaughter, and said Prestia had behaved responsibly but had no control over Sky’s employees.

“He can’t really supervise employees of the subcontractor,” Fischetti said. “That isn’t permitted.”

But Florence told the judge Harco shouldn’t be “insulated” just because it hadn’t given a “fancy title” to Prestia. “The law is not stupid,” she said.

The courtroom was packed Thursday with supporters of Moncayo’s family from a coalition of immigrant labor groups that said they hope the case will be a trendsetter for law enforcement in New York and nationally to use criminal prosecutions to combat a rising toll of worker deaths.

“In this case contractors blame each other so they can avoid their responsibility,” said Antonio Sanchez of the Worker’s Justice Project at a rally outside the courthouse. “It is completely ridiculous.”

Moncayo’s mother and family have not commented during the trial, but in a statement in Spanish handed out after the closings said, “We know that this will not bring Carlos back, but this will be a wake-up call to all the construction companies that they will put the worker safety first before the money.”

Omar Henriquez of Wantagh, an organizer with the National Day Labor Organizing Network, said he was hopeful about the outcome of the trial.

“The evidence clearly showed there was negligence,” he said. “We expect the judge to do the right thing.”