You can't really differentiate between the two. Part of the fear of the Soviet Union as an external power (i.e., not as a power that might infiltrate American society but as a power that could spread across the globe in a more traditional, imperial sense) derived from the belief that the Soviet Union maintained an ideology bent on world domination. The influential "Long Telegram" written by diplomat George Keenan in Moscow in early 1946 argued that Soviet expansionism was really a reflection of Russian imperialism and insecurity, but also asserted that these characteristics would be overblown because the Soviet regime was reliant on Marxism to justify its existence (and the deeds the Bolsheviks committed to come to power). Keenan blended the fear of the Soviet Union was a superpower with the fear Americans held of Marxism.
The general fear of Soviet Marxism at home also paralleled the fear of Soviet Marxism abroad in another significant way. This fear of Soviet foreign policy in that it was based on some measure of truth (some of the folks attacked by the House Unamerican Activities Committee did in fact spy for the Soviet Union) while at the same time it created a fantasy villain for American policymakers to chase around (in the end, the myth of monolithic international communism proved to be just that--a myth--as various Communist powers turned on each other when they lacked a common enemy). In other words, the combination of the fear of Soviet power and the fear of Marxism created a larger-than-life villain that Americans mistakenly believed could accomplish much as a collection of politicians and agents all focused on one single, common goal.
I think that today when we look back on communism and the Soviet Union, it's easy to differentiate between the ideology and the global power that espoused its tenets. During the Second Red Scare, however, the fear of a nuclear superpower and the fear of the rise of the Communist Party blended together to cause a panic. You are looking for a rational answer from people who were not thinking rationally at the time.
A mix between the two. It was a fear of a rival superpower from the view of the leaders and it was portrayed as a fear of communism for the citizens. Even though many leaders of the western bloc actually feared communism, the fear mainly came from rivalry and increased nuclear armament.