Out of universe, this is a common problem with fiction depicting alien cultures. It's not just ships: Klingon and Romulan uniforms are basically all identical, as are the haircuts, skin tones, voices, behaviours, vocal idioms... whereas the familiar human characters have the predictable wide range of all of the above. Occasionally we see the "odd one out" character (e.g. the Klingon scientist in Enterprise's Augment arc who doesn't give much of a crap about honour and "glorious battle"), but they usually stand out like a sore thumb.
In-universe we can only theorise that the Federation's propensity for developing many different classes of starship stems from a strong desire to explore many different kinds of phenomena and environments, whereas governments like Cardassia, the Romulan Star Empire and the Klingon Empire are largely content to pump out thousands of Galor, D'Deridex and Bird of Prey class ships because they are proven to work in combat, espionage, defence and all those other wonderful things that don't change too much.
Similarly, of course the Federation is comprised of many different species which is not largely true of the Klingon Empire (which subjugates) or of the Romulan Star Empire (which hides from). It could therefore be argued that a broader talent pool of design aesthetics and architectural approaches being available within the Engineering Corps could have resulted in a broader pool of extant, in-service ship classes (though I'm struggling to imagine cultural factors having an overbearing influence on what is ultimately a political/military/economic decision).
Jumping back out of universe again, we see a lot more of the Federation than we do of other civilisations. It's conceivable, though not particularly convincing, that it's just that we haven't seen enough of those other cultures to have "run into" their 52 other ship classes.