It had very little to do with people losing interest. In 1972 Nixon defacto completely cancelled the human space program, which he had been rapidly stripping away since Apollo 13. He was paranoid that a catastrophic failure was imminent and would negatively affect his 1972 election campaign. Interestingly when he signed off on the final stripping down in 1972, he remarked that we may never set foot on the Moon again this century. That would've sounded quite absurd at the time, but was ultimately completely correct.
It's kind of ironic that the stereotypical context of the space race was it supposedly having been a proxy for an ideological battle between capitalism and communism. Yet the US space program existed solely and exclusively due to a large and heavily centralized governmental effort. It's only in very modern times that private companies can take to the stars, completely independent of governments, which is why we've been able to make vastly made more progress in the past 10 years than we did in the 40 prior.
A good starting point off for going down this rabbit hole would probably be here. [1]
[1] - https://en.wikipedia.org/wiki/Canceled_Apollo_missions