Soviets definitely lost the race to the Moon - that's at least the overall feeling prevailing now in Russian space circles.
However USSR did participate in that race - even though they denied that for long time. USSR did a lot on that path; I'd say roughly 80% of the road to success.
That includes N-1 rocket, which in fourth flight almost completed successfully the first stage burn. Upper stages were better tested on Earth and had higher chances of working right in early flights. Also from the way first N-1 flew one can see that engineers were systematically eliminating problems. The Achilles' heel of the N-1 rocket was engines of the first stage - NK-15, which were due to be replaced in the next flight with much better NK-33. The next flight N-1 could already be significantly more successful; but the program was cancelled.
That also includes hardware like Soyuz spacecraft, which with a lot of modifications still flies today, and D stage, which is used on Protons and Zenits to boost satellites to the geostationary orbit. NK-33 engines flew on Antares rocket and on Soyuz 2-1v Russian rocket.
That also includes lunar landing ship, which was successfully tested on Earth orbit in three flights.
Additionally USSR had a good program for exploring the Moon with robots, including Lunokhods, lunar orbital spacecrafts and automatic sample return vehicles - Luna-16, Luna-20 and Luna-24. And also Zond program - with first circumlunar flights by a spacecraft which later returned to Earth with living animals onboard.
USSR had rather good lunar program - and that was way less expensive than American one - but lost the race to send a human to the Moon itself.
However, from Russian point of view, that was just a - big, but not final - episode in space. 1970-s were the decade of first space stations, and USSR achieved a number of impressive firsts there. Losing to America with reusable spacecraft - Buran flew only once, later than Shuttle, and that was still better than no landing at all in the Moon race - Russia kept perfecting orbital space stations, and Mir was the world class orbital laboratory - some features of which were surpassed by ISS only many years later.
At the end, Russia still has a unique combination of abilities to do things in space - even though it can't match USSR's pace.