The Subway diet made him do it.

That’s the excuse a defense psychiatrist has trotted out to explain former Subway pitchman Jared Fogle’s sex crimes.

“Once he lost weight, it seemed as though in a short time he had hyper-sexuality,” forensic psychiatrist John Bradford testified for the defense at Fogle’s sentencing Thursday morning in Indianapolis. “There are brain disorders that can be associated with sexual drive.”

Bradford, of the University of Ottawa, testified shortly after Fogle pleaded guilty to child-porn charges.

Fogle — who famously dropped 245 pounds on a diet of turkey and veggie subs — will be sentenced later Thursday.

The psychiatrist said Fogle had “mild or infrequent fantasies about pre-pubertal children,” but the psychiatrist said his diagnosis is “mild pedophilia,” the Indianapolis Star reported.

“There’s no evidence I know that he molested a child,” Bradford said by phone.

Asked about Fogle’s sex with 16- and 17-year-old minors, Bradford said, “16- or 17-year-olds are not pre-pubertal children,” the paper reported. “He didn’t have those types of cognitive distortions that you would see in those individuals.”

Bradford said he was concerned about Fogle’s eating disorder from childhood to college.

Bradford said Fogle had fantasies of young girls, age 12 or 13, but his main interest was older minors.

“Looking at all of this, I believe he did suffer from pedophilia, except it didn’t involve acting out with a child. He denies he ever touched a child.”

Fogle agreed in August to plead guilty to one count each of traveling to engage in illicit sexual conduct with a minor and distribution and receipt of child pornography.

The charges followed a July raid on his suburban Indianapolis home, and the resulting criminal case destroyed his career with the sandwich restaurant chain.

Before entering his guilty plea, US District Judge Tanya Walton Pratt asked Fogle whether he understood the punishment he could face and he answered, “Yes, your honor. I do.”

The sentencing portion is expected to begin after he makes a statement in court.

The judge then moved on to the sentencing phase of the hearing — going over aggravating circumstances such as Fogle possessing more than 600 images of child porn, the Indianapolis Star reported.

She also went over mitigating circumstances such as giving authorities timely notification that he planned on pleading guilty, the paper reported.

Fogle has admitted paying for sex with girls as young as 16 and receiving child pornography produced by Russell Taylor, the former head of The Jared Foundation, which Fogle started to raise awareness and money to fight childhood obesity.

Authorities said Taylor secretly filmed 12 minors as they were nude, changing clothes, or engaged in other activities using hidden cameras to produce child pornography.

Taylor has agreed to plead guilty to child exploitation and child porn charges.

Court documents detailing the charges against the 38-year-old father of two say that Fogle had sex at New York City hotels with two girls under age 18 and paid them for that sex.

Fogle agreed to pay a total of $1.4 million to his 14 victims, with each getting $100,000.

Fogle became a Subway spokesman after shedding more than 200 pounds as a college student, in part by eating the chain’s sandwiches. Subway ended its relationship with Fogle after authorities raided his home in July.

His attorneys are seeking a five-year prison term, saying he “is profoundly sorry for what he has done.”

They also wrote that Fogle suffers from “hypersexuality and alcohol abuse/dependence” and is committed to receiving treatment.

The attorneys also said he never engaged in any sexual conduct with any of Taylor’s minor victims and played no role in producing any of the images or videos recorded by Taylor.

With Post wires