Pegg, who plays Scotty in the rebooted franchise, said he hopes May follows the example of the captain of the starship USS Enterprise after she is handed the keys to 10 Downing Street.
Arriving at the UK premiere of Star Trek Beyond, which he co-wrote, Pegg urged: “Lead for the people, don’t forget anybody. Don’t just protect the people who are well off, look after everybody. There are a lot of people in this country who need to be looked after, who are so often forgotten.
“Ask yourself ‘what would Kirk do?’ Theresa.”
Pegg told the Press Association the film, which sees the crew of the USS Enterprise face a new and ruthless enemy, has messages that could benefit the British people following the vote to leave the European Union.
He said: “Ironically the message is it’s better together, unity is strength. It’s about co-operation and breaking down the boundaries between races and species and types and working together and it seems incredibly apposite at the moment considering the decision this country has just made, which feels a little bit to me like a retrograde step.
“We need to be a little bit more Star Trek, a bit more like the Federation.”
Pegg, who described himself as a “dyed in the wool” left-winger, also voiced his support for embattled Labour leader Jeremy Corbyn saying: “I respect Jeremy Corbyn because I like that fact he’s brought some opposition back into party politics.
“Party politics had become very bland, they had almost become the same party and you need someone to mix it up. You need the dark and the light, you need the opposites, you need debate and you need to move forward through debate and I think Jeremy is just standing up for shit and I have got to respect that.”
Zachary Quinto, who plays vulcan Spock in the film, echoed Pegg’s sentiment about the film’s message, saying unity is “something a lot of people in the world could benefit from right now”.
He added: “We all feel pretty fractured right now and the divisiveness seems really pervasive and overwhelming and that is unfortunate. There seems to be one way of thinking which is much more progressive and accepting and open and one which is much more xenophobic and nationalistic and closed off. I think there is only one clear path forward.”
Quinto said he could see parallel divisions in society in the UK and USA, as well as other parts of the world, adding: “It’s shocking to me how quickly it has happened, that we have split off into these two factions that are not really interested in what the other group has to say, it’s very intolerant on both sides.
“Openness and curiosity and connectivity are things that could benefit all of us in this day and age.”
Pegg and Quinto were joined at the premiere by their co-stars Chris Pine, John Cho and Karl Urban, as well as franchise newcomers Idris Elba and Sofia Boutella.
Star Trek Beyond is released in UK cinemas on July 22.