A large part of Nazi ideology involves the "master race" and the fundamental idea that aryans were better than everyone else. With the population being given this information, how did the Nazis justify an alliance with two countries who don't fit the "master race?"
This is a very frequent question and therefore it has its place in our FAQ section to the right. We advise every visitor of our subreddit to seek out our FAQ first before asking a new question. This section of our FAQ should be of interest to you.
To quote myself on this topic: The tl;dr here is basically that racism is not a consistently logical theory but an inherently irrational ideology that changes according to the political needs of racists. The alliance of Germany and Japan was one of convenience and alignment of interests. If the partnership would have ceased to be beneficial at some future point, it would have been scrapped most likely.
Ian Kershaw discusses this issue in "Hitler."
Hitler admired the Japanese people. He viewed in them what he viewed in the Aryan people. A people who loved their race and were against race mixing (intermarriage). Hitler described the Japanese as having a history that rivalled Germany's.
Races that he had a negative view of tended to be because he saw those races as not having their own country (such as the Jewish people) and instead lived amongst other races and worked against them. Jews in his mind were always plotting against those in whose country they resided.