It was racial in the sense that Adolph Hitler not only saw the Aryan Race as the rulers of Humankind and superior to others, he absolutely hated Jews, hence the Holocaust in which around six million were killed off in his extermination camps, so in this sense it was very racial. But I doubt this was the main motive.
I think a stronger motive was one of anger and resentment at the way Germany was treated by the victors after World War One. Hitler fought as an ordinary foot soldier, a private and then a corporal, and no doubt felt both humiliated and put upon by people such as the French, Russians and Poles.
He did not, in the earlier days, have quite as much antagonism against the British, despite their being an earlier enemy. "They are not our natural enemy," he is claimed to have said This changed later. It had too. After all, it was Great Britain who declared war on Germany when German troops invaded Poland.
As for the Japanese, they had observed very closely that 'Might is right,' from the moment the American Fleet sailed into Tokyo Bay in the 19th Century. It did not go unoticed by them that those who had the best armies and navies and the greatest military power, also happened to have created empires for themselves all around the world. The Japanese jumped on the 'empire building bandwagon' as soon as they could. For a bit like Adolph Hitler, their leaders thought of themselves as being superior.
But one must not forget the economics. Empires have always pulled lots of wealth from those they controlled. As a lad born in England in the 1930s, I truly believed for a long time that Englishmen were somehow superior to almost every other race. It took some growing up to realize that this is not true.