This makes sense; stars form from clouds of gas and dust, and larger stars require vastly larger clouds from which to form, but the larger the cloud, the more likely there are to be numerous density differences which ultimately condense into the "clumps" which form the cores of star formation.
Following is a table which lists the frequency of Main Sequence stars by spectral class:
Thus, on average, per every three million stars, 1 will be O-class, 3750 will be B-class, 18750 will be A-class, etc. Below is the same table (rounded to the nearest whole number) expanded to continue this analysis:
In general, if one were building a region of 100 star systems, 76 would be built around M-class stars, 13 around K-classes, 8 around G-classes, 3 around F-classes, and one each of either an A-class, B-class, or O-class. More than one of any of the last three classes in a group of 100 star systems is far too many to be realistic.
Note in the hierarchical graph above, Spectral Type O is too small to even appear.
Expanding to the Milky Way, with a maximum estimated population of 400 billion stars, we find the following numbers of stars in the given spectral type:
Conversely, in a globular cluster, hot, blue stars are few-to-none in number because the majority of stars are old and well-along in their Main Sequence lifetimes, some having also passed off the Main Sequence into their red giant phase.
Below is a table listing the spectral class and masses of the most Sun-like solar analog stars:
Not also that the tables do not include the entire range of K and F spectral types; this is because the limitations on mass are the determining data.
Stars of spectral type O, B, and A are massive stars that shine significantly in the ultraviolet. The intensity of their light would cause loss of planetary atmospheres through thermal escape and photoevaporation. As the atmosphere disappeared, that same ultraviolet radiation would increasingly bathe the surface of the planet. Ultraviolet-resistant organisms exist on Earth, but none have evolved high levels of complexity.
M-type stars are so dim that planets orbiting close enough to receive adequate stellar irradiance for habitability would be on orbits that would expose them to stellar weather such as coronal mass ejections and prominences that would be significantly more antagonistic to life than even the ultraviolet light of their much more massive cousins. Tidal locking of M-star planets due to their close-in orbits has also been expressed as a concern for the habitability of such planets.
Stellar Main-Sequence Lifetimes
M-type stars have significantly longer lifespans (some longer than the current age of the universe!), but, again, make poor hosts for habitable planets due to their low temperatures and consequent low luminosities, as well as the concerns mentioned above.