Although we know him best for his poetry it is worth remembering that Khayyam was a mathematician of some note, and an astronomer. As a scientist he had views on religion that were not popular when he lived when he was labeled a skeptic and a sinner.
In truth he was probably more of an agnostic than an atheist and more of a Sufi mystic than a sinner. At heart, as he displays in the quatrain below, he believed that we make our own fate. He rejects the notion, so beloved of venal faithful of all religions, that you can behave badly on earth and be somehow rewarded in the afterlife.
I sent my Soul through the Invisible,
Some letter of that After-life to spell:
And by and by my Soul return’d to me,
And answer’d “I Myself am Heav’n and Hell