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.
If you can pray the Sunnah of the Fajr at home and then pray the obligatory prayer in the mosque, then this is the best option, as the Prophet said, “The best prayer of a person is that performed in his home, with the exception of the obligatory prayer.” [Al-Bukhaari and Mulim]
If you can either perform the obligatory prayer at home along with the Sunnah of the Fajr before it or pray the obligatory prayer only in the mosque in congregation, then you should hasten to the mosque and pray the obligatory prayer and then make up for the Sunnah prayer directly after the obligatory prayer or after sunrise.
Some scholars hold the view that praying in congregation is an obligation, and some of them have the view that the congregational prayer is obligatory in the mosque.
The Fatwa of the Standing Committee reads:
“It is better to perform the regular Sunnah prayers and other optional prayers at home, as it was reported in a long authentic hadeeth that the Prophet said, ‘Pray in your homes, as the best prayer of the person is that performed in his home, with the exception of the obligatory prayer.’ [Muslim] However, if you fear to miss the congregational prayer if you pray the Sunnah before the Fajr at home, due to the time of the Iqaamah (establishment of the prayer) being near, then pray the Sunnah in the mosque. If you start to pray the Sunnah of the Fajr and the Iqaamah is called, then you should interrupt your Sunnah prayer and then pray it after the obligatory prayer or after the sun sufficiently rises in case of the Fajr prayer... ”
Allah knows best.