Racism and commercialism are certainly two of the factors (but not the only two factors) that contributed to American imperialism in our dealings with the countries mentioned.
One aspect of American thought in the late 1800s and early 1900s was the idea of the “white man’s burden.” This idea held that Americans were simply racially superior to most of the other people of the world. They were certainly superior (they thought) to non-whites like those who made up most of the populations of the countries mentioned. They believed that they needed to take care of the non-whites who were not really capable of governing themselves. This was one reason to engage in imperialism.
A second reason to engage in imperialism was commercial. Businesses in the US wanted preferential access to the raw materials of places like Cuba and the Philippines. They also wanted to be able to sell manufactured goods to people in those countries. In order to get preferred access to these markets, they encouraged imperialistic actions by the US government.
Thus, we can say that racism and commercialism helped contribute to imperialist policies on the part of the United States.