My question is: To what extent can the leading role of the US in science and technology during the 20th century be credited to it being the last superpower left excluding the USSR?
It's a little more complicated than saying they are the "only superpower," but there is no doubt that the mantle the US took on in the Cold War had a big effect on its dominance of the scientific and technological scene. Aside from the massive "brain drain" to the United States from Europe during World War II, the US, especially in the post-Sputnik period, poured ridiculous amounts of resources into scientific and technological infrastructure at every level. The post-1957 education reforms, for example, changed how science was taught at every grade in the American educational system, with the explicit goal of recognizing latent talent and promoting the production of scientists and engineers. The amount of money that the government spent fostering what Eisenhower called the Military-Industrial Complex is still impressive (and far higher than is spent on science by the US government today, as a function of GDP).
Some graphs I use when teaching:
Federally funded R&D in constant 2000 dollars: an interesting way to plot the relative dollars, and the relative funding for both civilian and defense functions. One can clearly see how the initial funding was primarily military in nature, but the civilian expenditures reached parity around the time of the Apollo program. Military boomed again in the 1980s under Reagan, and again after 9/11.
Same graph, but as percentage of the GDP, which puts into perspective how large that initial effort was, the Space/Missile Race, and what Eisenhower had in mind when he warned in 1961 that he thought things were getting a little out of control. That's 2% of the GDP was federal expenditure on R&D in the mid-1960s is kind of mind-boggling. If you want to compare total R&D (including private), and compare across countries, here is some useful data. Total R&D (public + private) in the US is about 2.79% of the GDP today, which is very high, despite the economic cutbacks. By comparison, China is 1.98%, Germany is 2.92%, France is 2.26%, Russia is 1.12%. Couple it with the fact that the US GDP is very large (about $17 trillion USD) and that's a lot of economic activity being directed into R&D. (There are other measures that qualify this — e.g., as a percentage of population, the US spends fewer dollars than, say, the British.)
This all translated into a major boom (and eventually, bust) in US scientists and engineers. Here's a nice graph of US PhDs in physics, which is just a useful proxy for thinking about these kinds of trends. I've annotated it so you can see how the numbers reflect changes in world situation and policy. You can see that while WWII did produce a boom, by the mid-1950s it flattened. It isn't until Sputnik that the boom became truly exponential, and like all exponential functions in nature, it eventually came to and end (in 1970, when a number of reforms occurred that caused big cut-backs in federal funding, and also the market just became too saturated). This data comes from the work of David Kaiser at MIT, who has been working for a long time about the "bubble" of the Cold War and its effects on American science and technology, in particular physics.
The way you've phrased your question makes it seem inevitable that the US rise in science and technology resulted from World War II. This is not the case — it was the result of conscious policy decisions regarding the US role in the world, and the role that science and technology would play in enforcing that role in the world. The US had many advantages after World War II, but its dominant position came from trying to exploit those advantages to the fullest, which, again, it didn't actually do right after WWII — 1957 is the key date here, not 1945.