If there are other deobandi masajid in the area, then it is better for you to go to those masajid. However, as long as you know that the Imam of the certain barelwi masjid does not hold any incorrect shirki aqeedah, your salah in that masjid will be valid. This is not only limited to Barelwis rather Ahl Hadith, Wahabis too. As long as the Imam has no beliefs which are corrupt, salah behind him is valid. Mufti Ebrahim Desai Saheb has mentioned it better: and