The billionaire is due to meet Rishi Sunak on Wednesday at the UK’s international AI safety summit at Bletchley Park.
Speaking to Joe Rogan’s podcast, Musk said he was an environmentalist but some “have gone way too far”.
“If you start thinking that humans are bad, then the natural conclusion is humans should die out,” he said.
“If AI gets programmed by the extinctionists its utility function will be the extinction of humanity. They won’t even think it’s bad.”
Musk is due to conduct a live interview with Sunak on X/Twitter on Thursday evening.
Downing Street proudly promoted the chat with a graphic showing the No.10 logo being replaced with an X.
Other industry figures are due at the summit include Meta’s global affairs chief Nick Clegg.
But several high-profile leaders have decided not to attend, including US president Joe Biden and French president Emmanuel Macron.
Sunak has also upset some of his backbenchers by inviting China to the summit, as many Tory MPs believe Beijing should be treated as more of a threat.
Last week Sunak warned humanity could “lose control” of AI if safety measures were not put in place.
The prime minister said AI could make it easier to create weapons of mass destruction, help terrorist groups and crime gangs and spread disinformation around the globe.