President Trump threatened to throw a Time journalist in jail for taking a picture of a letter from North Korean leader Kim Jong Un in the Oval Office despite being warned not to, according to the magazine.

During an interview with Time on Monday, the president showed a team of four reporters a letter he said was “written by Kim Jong Un,” saying “it was delivered to me yesterday. By hand,” the mag’s transcript shows.

Trump then asked to go off the record as the conversation turned to his Democratic opponents in the 2020 election. At one point, White House press secretary Sarah Huckabee Sanders said, “You can’t take a picture of that, sorry.”

According to the transcript, Trump reacted by saying, “What was that?!”

The reporters later asked about former campaign manager Corey Lewandowski, who testified that Trump ordered him to tell then-Attorney General Jeff Sessions to limit the probe into Russian interference in the 2016 election to only “future election meddling.”

When one of the Time staffers noted that Lewandowski had testified under oath and “under threat of prison time,” Trump snapped back: “Well, you can go to prison instead, because, if you use, if you use the photograph you took of the letter that I gave you confidentially.”

According to Time, he added: “I didn’t give it to you to take photographs of it — So don’t play that game with me. Let me just tell you something. You take a look …”

The Time journalist interjected: “I’m sorry, Mr. President. Were you threatening me with prison time?”

“Well, I told you the following. I told you you can look at this off-the-record. That doesn’t mean you take out your camera and start taking pictures of it. OK?” Trump said, according to the transcript.

“So I hope you don’t have a picture of it. I know you were very quick to pull it out — even you were surprised to see that. You can’t do that stuff,” he continued.

“So go have fun with your story. Because I’m sure it will be the 28th horrible story I have in TIME Magazine because I never — I mean — ha. It’s incredible. With all I’ve done and the success I’ve had, the way that TIME Magazine writes is absolutely incredible.”

Trump continued railing against Time, which named him “Person of the Year” in 2016. The following year, he said, he turned down an offer from the mag to be named again — a claim Time refuted.

“Some day within the next 20 years,” he said in the interview, “maybe you’ll pick me as Man of the Year. OK, big deal.”

Time told The Post in a statement that “at various points during the interview, the President asked to go off-the-record, and TIME is honoring those requests.”

Sanders did not immediately respond to a request for comment.