Elizabeth Taylor nearly took a James Dean secret to the grave — but decided the bombshell that her “Giant” co-star had been molested by a boyhood pastor could be told after she was gone.

“I’m going to tell you something, but it’s off the record until I die. OK?” the screen legend told writer Kevin Sessums in a 1997 interview. “When Jimmy was 11 . . . he began to be molested by his minister.

“I think that haunted him the rest of his life. In fact, I know it did.”

Over the years, several Dean biographers have claimed he had a longstanding consensual sexual relationship with the Rev. James DeWeerd, a Wesleyan pastor in Fairmount, Ind., who had a penchant for young boys.

Dean was 9 when his mother died of cancer and his dad sent him to live in Fairmount.