When the U.S.A. needed USSR as an ally in World War II, it needed voter support for having USSR as an ally, so U.S.A. opinion makers said less about the bad things that were going on in USSR. For instance, Stalin starved millions of people to death to make it easier for him to implement his policies for control. Everybody in USA today knows about Hitler's killing of millions of Jews and Eastern Europeans, but few people in USA today know about Stalin's starving (killing) millions of Ukranians.
There was great fear of communism in the 1920s. Spearheaded by A. Mitchell Palmer, the red-scare was felt by most Americans. Employers were able to squash labor union strikes by insinuating the leaders were communists, immigrants were expected to prove their loyalty, the KKK was able to take advantage of the fears and grew to phenomenal numbers.
Hoping to balance the growing power of the Axis countries, Roosevelt opted to acknowledge Russia as a communist country during the '30s.
By 1941, Hitler had turned on the Soviets and "our enemy's enemy is our friend" became the attitude of politicians. Better to befriend the communists in order to defeat Hitler/Mussolini/Tojo.
When the Soviet Union was "born" the US did not recognize it because it was a communist country. The US already did not like the idea of communism and they believed that the Russians would try to spread communism abroad.
By the early 1930s, the US was more concerned about the Depression and there was a more liberal president in the White House so they recognized the USSR.
In 1941, Germany invaded the Soviet Union and all of a sudden they started to look like a potential ally for the US since FDR thought Hitler was a major threat to the world.