It is permitted to enter a mosque. This is the ruling of the Rambam in a letter, cited as authoritative by R. Ovadia Yosef (Yabia Omer Vol. 7 YD 12).