Ron Moore was just 5 years old when his future was set in stone.

“I was a kid when I saw Neil Armstrong walk on the moon, and it was a seminal moment in my life,” Moore, 55, tells The Post.

“I remember [my] mom and dad telling me those men on the TV were on the moon… which I could see out of my bedroom window, and I asked my mom, ‘Why can’t I see them?’ I couldn’t grasp the idea of why I could see the moon but couldn’t see the astronauts. That image stuck with me. If something else came on TV about space, I wanted to see it … that led me to science fiction.”

The writer and producer, best known for “Star Trek” and “Battlestar Galactica,” returns to the final frontier — after taking a break with “Outlander” — for Apple TV+’s “For All Mankind.” (Episodes premiere weekly on Fridays.)

Starring Joel Kinnaman (“House of Cards”) as astronaut Ed Baldwin, the show is an alternate history imagining a world in which the former Soviet Union succeeded in the first moon landing in 1969, resulting in America scrambling to catch up. (In reality, June 2019 marked the 50th anniversary of the historic Apollo 11 moon landing.) Set in Houston and Florida (but filmed in LA), “For All Mankind” splits its time between drama at NASA and the astronauts’ home lives. Although Kinnaman’s character is fictional, female astronaut Molly Cobb (Sonya Walger, “Lost”) is based on the real-life Jerrie Cobb, and supporting characters such as office head Deke Slayton (“True Blood’s” Chris Bauer) are real.

The idea started when Moore’s longtime contact and then-freshly minted Apple TV+ exec Zack Van Amburg floated the idea to do a show that was essentially “Mad Men” at NASA.

“The more I thought about it, the more I realized you could do that show and do a character piece,” says Moore. “But I also realized the story of NASA in the ’70s was — in my opinion — sort of a sad one, with cutbacks and lowering ambitions. It was coming off the glory of the Apollo era and things got smaller and smaller. It’s kind of a depressing tale,” he says, referring to the fact that the last moon landing was in 1972, while manned flights to Mars have never come to fruition.

“I said to Zach, ‘What if we did the alternate history version? The bigger version of the space program, the program we were promised when I was a kid and what I thought was going to happen, and that we were going to go much bolder into space?’”

The first three episodes (already available) find Ed watching from a local Houston bar as a Russian expedition beats the planned Apollo 11. Ed is filled with deep shame, since he was on the rehearsal mission, Apollo 10, ordered not to land. He gripes about it to a reporter, which puts him in the doghouse with NASA.

Moore also remains an executive producer of historical time-travel drama “Outlander,” which has been renewed for forthcoming fifth and sixth seasons on Starz.

In the meantime, he’ll stay reunited with his greatest love, space, since “For All Mankind” has already been renewed for a second season.

“It’s that eternal human thing of ‘What’s over the next horizon?’ ” he says. “When people stood at the edge of the ocean and figured what was over the horizon and new adventures and new lands and new places to go. Space has always been that for me, you look up at the stars and wonder what’s there, what’s behind them, are there people out there? ‘For All Mankind’ is a very optimistic show. It’s not just changing history, but changing history for the better.”