A. Poskim write that the entrance of Gentiles to a shul should be avoided as much as possible (Yigal Yaakov O.H. 20, Piskei Teshuvos 151:6).
However, Yabia Omer Y.D. (3: 15) permits in need and when there is benefit, to let tourists enter a shul. Yet the Aron Hakodesh should not be opened for them to show the Sifrei Torah.
Similarly, Poskim permit the entrance of security guards, cleaning and maintenance crews as required.
They also permit the occasional address of political leaders for the benefit of the community and the keeping of Darkei Shalom and peace.