All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad (
) is His Slave and Messenger.
It is not obligatory for you to go to the mosque if you strongly believe that the congregational prayer has already ended.
Ibn ʿUthaymin
– while holding the view that prayer in the mosque is obligatory – said: “If it is assumed that he knows while in his house that the congregation has already finished, then we say: there is no difference; pray in your house.” [End quote.]
Predominant assumption takes the ruling of certainty, as is well known.
Furthermore, the view according to which we issue our fatwa is that congregational prayer is obligatory upon men. However, performing it specifically in the mosque is not obligatory; rather, it is valid to establish it in any place. Whoever performs it in congregation in his home has fulfilled his obligation and bears no sin. This is the relied-upon position in the Hanbali school.
We also advise you to beware of baseless misgivings (waswasah), for their harm is great.
Allah Knows best