It is important that one is upon the belief Ahlus-Sunnah wal-Jamāʾah, but what is the ruling on praying behind one who is opposed of it?
A fatwā from Sheikh ibn Bāz (رحمه الله) will answer this, ʾIn shāʾ Allāh.
He (رحمه الله) was asked:
"Is it permissible to pray behind a person whose beliefs are opposed to those of Ahlus-Sunnah wal-Jamāʾah, such as an Ashʿarī, for example?"
Then he (رحمه الله) responded:
"The best answer, and Allāh knows best, is that it is permissible to pray behind anyone who is judged to be a Muslim and it is prohibited to pray behind anyone who is not judged to be so. This is the saying of a number of the scholars, and it is the most correct. As for those who say that prayer is nott accepted behind a sinner, his saying is rejected. The evidence for this is that the Prophet (ﷺ) allowed prayer behind rulers, and among rulers are many who are sinners. ibn ʿUmar, Anas, may Allāh be pleased with them, and others prayed behind al-Ḥajjāj, who was the most unjust of men. In short, prayer behind any innovator who is not outside the fold of Islām is accepted, as is prayer behind an open sinner, so long as his sins do not remove him from the fold of Islām. However, it is incumbent that a person from Ahlus Sunnah be appointed if they are able to join together and put forward the best of them."
So the benefit of this fatwā is that it is permissible to pray behind anyone who is judged to be a Muslim, even if they are opposed of Ahlus-Sunnah wal-Jamāʾah, so long as his sins don't remove him from the fold of Islām.
May Allāh have mercy on Sheikh ibn Bāz, and reward him for his great contributions to the religion of Islām.
May Allāh bless you, and shukran.
Source : Fatāwā Islāmīyah vol no. 1, page no. 158/159