Last I checked, gaijin (or gaikokujin) were allowed in Japan. Apparently, there are over 1.5mil foreign residents living in Japan.
However, it is possible that there is a degree of racism. Foreign residents are required, by law, to carry "alien registration cards" on their person at all times, while japanese residents are not required to carry identification.
Only way we will know for sure is if a non-japanese resident comes here and tells us what's up.
In all seriousness though, this is kind of a ridiculous question.
Humans as a whole are ignorant, self-serving, prejudiced morons who will alienate people that don't "fit in" with them. Every country will have a degree of racism, it's just handled much differently depending on the country. Japan is more comedic towards representations of racism, much like the US. However, in the US, if someone goes into a bakery and sees that the chocolate cake is in the back row behind the vanilla cakes, the ACLU will basically firebomb the bakery for being a den of racism and bigotry supported via confectionery bribery and suggestiveness.
I doubt Japan as a whole is racist. In fact, I haven't heard of racist incidents until this thread (it's not even a common stereotype for me). However, I won't be surprised if there are indeed racists over there, as racists exist just about in every country. :dunno: