The 'Hot Fuzz' star will play school teacher Neil Clarke in the film, directed and co-written by Terry Jones, reported Digital Spy.
The Python team will play visiting aliens who bestow magical powers to Pegg's character.
The actor is an old hand at the sci-fi genre, having starred in both 'Star Trek' movies.
"As someone whose love of comedy was hugely informed by Monty Python, the chance to work with Terry was a gift," he said.
"Meeting your heroes is one thing - working with them is something else."
More From This Section
"Simon Pegg is the absolutely perfect Neil. It is not a Monty Python picture, but it certainly has that sensibility," Jones said.
Oscar-winning actor and stand-up comedian Robin Williams has also been cast as the voice of Neil's dog, Dennis.
Production on 'Absolutely Anything' is scheduled to begin in London on March 23, 2014.