All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
If what you meant by Ar-Raazi is Fakhr Ad-Deen Muhammad ibn ‘Umar ibn Husayn ibn ‘Ali Al-Qurashi At-Taymi Al-Bakri, the well-known interpreter of the Quran and the author of other books, then he was not an atheist; rather, he was among the scholars of this Muslim nation. However, he had been afflicted with theology and some other matters, then he repented from theology at the last part of his life. Ath-Thahabi in “Siyar A’laam An-Nubalaa’” said about him: “We noticed in his writings some great calamities, enormous affairs, magic and deviation from the Sunnah, and we hope that Allaah will forgive him, as he died while following a correct methodology, and it is Allaah Who knows the secrets (of hearts).”
However, if you refer to Abu Bakr Zakariyyah Ar-Raazi, who is among the philosophers and physicians, then he was an atheist philosopher and he was not Ar-Raazi whom we mentioned above. The former died in 606 A.H. and the latter died in 311 A.H. So, there are three centuries between them.
Allaah Knows best.