A man who police said has a history of trying to entice teen girls into making porn videos is free while awaiting trial after a Nassau judge canceled his $500,000 bail, citing the cost to the county of caring for the defendant, who has cancer.

Court records show prosecutors repeatedly opposed the release of Andrew Quattrone, 33, of Lindenhurst, without bail or any supervision, calling him “a danger to children” and “risk to society.”

Police arrested Quattrone in February 2015 after they said he asked two 14-year-olds in Massapequa Park if they’d make an “adult video” with him after showing them explicit photos and condoms.

Quattrone, who has acute lymphocytic leukemia and is getting chemotherapy, pleaded not guilty to felony charges of trying to use a child in a sex performance and criminal solicitation, along with misdemeanor child endangerment charges.

Records show correction officers kept a 24-hour watch on Quattrone in a private hospital where he was treated during at least some of his time in jail.

But on March 9, acting State Supreme Court Justice Terence Murphy released him on his own recognizance while alluding to the cost of his care, including having correction officials watch him while he is hospitalized.

advertisement | advertise on newsday

“Additionally, his medical treatment is being, as far as the court knows, underwritten by Nassau County, as he’s in the custody of the county,” Murphy said.

A court spokesman said Friday the judge couldn’t comment on a pending case, but bail “is to ensure a defendant’s return to court … not for detention or punishment.”

A district attorney’s office spokesman declined to comment. Quattrone’s lawyer, Joshua Kahn, didn’t return calls.

By March 21, Quattrone was no longer a hospital inpatient and appeared in court, where Murphy denied prosecutor Christine Guida’s appeal for a $500,000 bail reinstatement.

Kahn argued Quattrone wouldn’t go to jail, but again be hospitalized on the county’s dime, if bail was restored. He’s said Quattrone planned to live with family — who are in Suffolk County — and needs three to four years’ medical treatment.

In denying the prosecution’s repeated bail request, Murphy warned Quattrone he’d revoke his release status if hearing “from any source, that you’re engaged in any type of criminal conduct.”

Records show probation officials said an interim probation whereby Quattrone was supervised before any resolution in his case was “not feasible.”

When arrested, Quattrone already was facing a 2014 misdemeanor charge for allegedly going to a Levittown school and lobbying an 18-year-old to be in a porno — a case for which he got 90 days in jail after a plea.

In 2009, Nassau police arrested him for allegedly trying to solicit sex acts from three girls, ages 12 to 14, while out on bail in a gun case.

Quattrone later pleaded guilty to charges that didn’t require sex offender registration and got 2 to 4 years in prison. But he wouldn’t do sex offender rehab there, and twice was denied parole.