A New York City man dodged the threat of a 20-year kiddie-porn prison sentence — all thanks to the kindness of a porn star.

Carlos Simon-Timmerman, a pizza-delivery guy from Brooklyn, was put on trial in Puerto Rico for allegedly transporting child pornography after US Customs agents found a dirty DVD called “Little Lupe the Innocent” in his bags as he passed through San Juan Airport security on his way back to the city.

The agents said the actress in the video, porn star Lupe Fuentes, was underage, and they cuffed him.

But Simon-Timmerman was sprung earlier this month after Fuentes flew to Puerto Rico and proved in court that she was 19 at the time the film was made.

“I’m thankful to her,” his mom, Eff Simon, told The Post yesterday. “It was a big relief.”

Simon said her son had been visiting his sister last year in Venezuela when he bought the DVD in a flea market, believing it was nothing more than legal smut.

When Simon-Timmerman arrived in San Juan last Aug. 11, customs agents found porn videos, including “Little Lupe the Innocent — Do Not Be Fooled By Her Baby Face.”

Apparently, the agents were fooled — they arrested him for kiddie porn.

At his trial this month, the feds put a pediatrician on the stand who insisted Lupe was underage.

But that was before Simon-Timmerman was able to put “Little Lupe” — a Spanish native whose real name is Zuleydy Piedrahita — on the stand, where she produced her passport and photo ID.

His attorney, Hector Ramos-Vega, said he tracked her down through her Web site and persuaded her to appear in court. She asked for no money and was enthusiastic about helping, Ramos-Vega said.

US marshals paid for her trip because the lawyer had served her with a subpoena.

Ramos-Vega said Lupe’s testimony bashed the credibility of the doctor and federal agents.

“She didn’t have to do that, but it was crucial for our case,” Ramos-Vega said. “I know Carlos was very grateful — it was like he was born again.”

todd.venezia@nypost.com

