The short answer is that every method of putting a bunch of habitable world in star system as potential problems. And there is one method which has not yet been suggested, putting planets equally spaced along an arc of a single orbit, mentioned in part four.
Part One: Habitable planets in different orbits in the habitable zone.
Astronomers and astrobiologists know that it is possible for a star system to have one planet in a orbit where the planet can be habitable for human beings in particular and for liquid water using life in general. We have the example of the solar system with the planet Earth.
All planets habitable for human beings and other oxygen breathers in particular, or for liquid water using life in general, should be with the Goldilocks zone or circumstellar habitable zone of their star.
And the obvious way to find out the limits of the habitable zone of a star is to compare its luminosity to that of the Sun and use that to adjust the inner and outer edges of the star's habitable zone. So what are the inner and outer edges of the Sun's habitable zone?
The table here: https://en.wikipedia.org/wiki/Circumstellar_habitable_zone#Solar_System_estimates
includes about a dozen different estimates of the inner or outer edges, or both, of the Sun's circumstellar habitable zone. Note how different those estimates can be.
I advise all writers who are certain they will want one and only one habitable planets in a fictional solar system, and who may be worried about future discoveries proving their fictional planet couldn't possibly be habitable, to put their planet at a distance from the star where it receives exactly the same amount of radiation as Earth gets from the Sun. I call that distance the Earth Equivalent Distance or EED of the star in question.
And considering how narrow some calculations of the Sun's habitable zone are, it would be a good idea to calculate the EED of your star and then put the semi-major axis of the orbit of your planet no more than one percent closer or farther to the star than the EED of the star.
The answer by user177107 to this question:
https://astronomy.stackexchange.com/questions/40746/how-would-the-characteristics-of-a-habitable-planet-change-with-stars-of-differe/40758#40758
Includes a table which lists details of the EED orbits for main sequence stars of different spectral types.
Writers who want more than one habitable planet in their star system need to either find a way to make them share the same orbit at the same distance from the star or else put them in concentric orbits around the star with different semi-major axis.
And if they want their stories to be scientifically plausible they can use only a many concentric orbits as can fit inside the habitable zone of their star, which means they will have one of the wider estimates of the habitable zone of the Sun as the basis for calculating the habitable zone of their star.
One problem with that is only one of the estimates in the list, that of Stephen H. Dole in Habitable Planets for Man, 1964, is for planets which are habitable for human beings (and thus for lifeforms with the same environmental requirements), and it is so old that it might be obsolete in some respects.
https://www.rand.org/content/dam/rand/pubs/commercial_books/2007/RAND_CB179-1.pdf
The other estimates of the Sun's habitable zone are for liquid water using life in general. We know that some lifeforms on Earth survive without oxygen, and that it took billions of years for non oxygen using lifeforms to produce an oxygen rich atmosphere as a byproduct of their life functions. Thus a planet can be totally uninhabitable for humans or other oxygen need lifeforms while still being habitable in the eyes of astrobiologists.
Some of the estimated habitable zones for the Sun extend the inner or outer limits of the habitable zone for planets with specific types of atmospheres which can keep them at the proper temperatures for liquid water. And those specific types of atmospheres might not be breatheable for humans or for other intelligent animals who breath oxygen.
So thus the distance ratio of the outer edge of your star's habitable zone divided by the inner edge might be only about 1.5, or 2.0, or some other low number, which might greatly limit the number of stable planetary orbits which can be found within the habitable zone.
You can't put an arbitrarily large number of planetary orbits within the habitable zone of your star because planetary gravitational interaction produces forbidden zones around a planet's orbit where other planets would be driven out of orbit.
I don't know the formula for calculating a planet's forbidden zone, but like the formula for its Hill sphere it involves the masses of the planet and the star and and the distances between them.
The stronger the gravity of the star is at the distance of the planet's orbit, the smaller the planet's forbidden zone should be. And a relatively small change in the mass of a star makes a relatively large change in the star's luminosity. Thus I think the smaller the mass of the star, the deeper into its gravity the habitable zone should be, and the smaller the forbidden zones of the planets in its habitable zone should be.
However, the opposite has been claimed, that the forbidden zone of a planet is smaller in the habitable zone of a higher mass star than a lower mass star.
The star’s mass does affect the size of a planet’s Hill radius. Compared with an Earth orbiting the Sun, an Earth’s Hill sphere is twice as big around a star 1/8th as massive as the Sun. That means only half as many planets could fit on a given ring, and each ring would have to be twice as far apart. So only 1/4 as many planets would fit into the habitable zone. This argues in favor of relatively massive stars.
https://planetplanet.net/2017/05/03/the-ultimate-engineered-solar-system/
And finding out which is correct would be important for a writer designing a star system with many habitable planets.
The answer by Molot mentions the TRAPPIST-1 system. TRAPPIST-1 is an M8V class star, very dim, with a habitable zone very close to it. The planets d, e, f, & g are possibly in the habitable zone of TRAPPIST-1. The semi-major axis of the orbit of g is about 0.04683 AU, which is about 2.1028 times the semi-major axis of the orbit of d, which is about 0.02227 AU. That is an unusually narrow spacing for 4 planetary orbits.
https://en.wikipedia.org/wiki/TRAPPIST-1
The smallest known ratio between the semi-major axis of two consecutive planetary orbits is between Kepler-36 b & c. The semi-major axis of the orbit of Kepler-36 c is about 0.1283 AU, about 1.11274935 times Kepler-36 b's semi-major axis of about 0.1153 AU.
https://en.wikipedia.org/wiki/Kepler-36
So if a system has four planets each with orbits 1.1127 times that of the next innermost planet, the most distant planetary orbit would have a semi-major axis about 1.3778 that of the innermost planetary orbit.
Going by those examples, a star system would need a habitable zone with a ratio between inner and outer edges of at least 1.3778 and possibly 2.1028 to have four planets orbiting in four separate orbits within the habitable zone.
Of course calculations indicate that tidal interactions with a star would make planets in the habitable zones of low mass stars tidally locked so their rotation period was the same length as their orbital period. And astrobiologists have fear that a tidally locked planet would not be habitable. Some recent calculations indicate that tidally locked planets can be habitable.
https://en.wikipedia.org/wiki/Planetary_habitability#Size
Part Two: Trojan planets.
And maybe you could try making making four habitable planets share one single orbit within the habitable zone of the star, which thus can be a very narrow habitable zone, as narrow as some estimates indicate.
One method would make the four habitable planets be distributed between the L4 and L5 positions in the orbit of a giant planet or a brown dwarf as suggested in the answer by theresa May.. If using four habitable planets in those Trojan positions, I would put two in the L4 position and two in the L5 position to minimize the complications of the gravitational interactions between the habitable worlds. And maybe the two planets in each Lagrange position could be a double planet orbiting each other in the Lagrange position.
I note that astronomical objects in the L4 and L5 positions tend to oscillate around the exact points, getting rather far from them before returning to them.
The relative masses of the primary, the secondary, and the tertiary objects in the L4 and L5 positions need to be considerably different for stable orbits. In the case of artificial satellites in the L4 and 5 points of the Moon's orbit around the Earth:
The L4 and L5 points are stable provided that the mass of the primary body (e.g. the Earth) is at least 25[note 1] times the mass of the secondary body (e.g. the Moon),[19][20] and the mass of the secondary is at least 10 times[citation needed] that of the tertiary (e.g. the satellite).
https://en.wikipedia.org/wiki/Lagrange_point
So if the habitable planets are about Earth mass, the giant planet would have to be at least 10 times the mass of Earth, which would be a very small giant planet, and the star would have be at least 250 times the mass of Earth, which is much less than the minimum mass for a star.
However, there is also this statement:
As a rule of thumb, the system is likely to be long-lived if m1 > 100m2 > 10,000m3 (in which m1, m2, and m3 are the masses of the star, planet, and Trojan).
https://en.wikipedia.org/wiki/Trojan_(celestial_body)#Stability
I think that the time period that an artificial satellite's orbit would need to be stable would be a minute fraction of the time that a habitable planet's orbit needs to be stable.
So if m3 is a habitable planet about the mass of the Earth, m2 would have be a brown dwarf with at least 10,000 times the mass of Earth (the minimum mass for a brown dwarf is about 13 times the mass of Jupiter or about 4,131.4 times the mass of Earth) and M1 would have to have more than 1,000,000 times the mass of Earth.
The mass of the Sun is listed as 332,950 times the mass of Earth, so the star in the system would have to have at least about 3.0034 times the mass of the Sun. A B8V type star would have a mass of about 3.38 the mass of the Sun.
Spectral class B stars have main sequence life spans of about 50,000,000 to 100,000,000 years https://beyond-universe.fandom.com/wiki/Class_B_star.
The planet Earth did not acquire an oxygen rich atmosphere and become habitable for humans and similar lifeforms until it was several billion years old, so it is extremely improbable that a spectral class B star would have natural habitable planets or planets with intelligent life. Thus the only chance for a spectral class B star to have habitable planets or intelligent life would be if the planets were terraformed by an advanced civilization sometime in the past.
A writer can try to make the habitable planets in the Trojan positions have much less mass than Earth, as little mass as is consistent with habitability, which might reduce the minimum required mass for the star to a mass within the range of star masses capable of having habitable planets.
Part Three: Habitable moons of giant planets.
Or maybe the habitable worlds can be four giant habitable moons orbiting three, two, or one giant planets, to reduce the needed number of orbits within the habitable zone, as suggested in Willk's answer.
I don't know if two giant planets could have separate orbits within the habitable zone of a star. Because of their relatively large masses relative to the mass of a star, their forbidden zones might be too large to have two planetary orbits within a narrow habitable zone.
So a writer might have to put all four habitable worlds in orbit around one gas giant planet.
The planet Jupiter has four large moons in orbit around it. Callisto, the outermost of the large moons, orbits with a semi-major axis of 1,882,700 kilometers, which is 4.4634 times the semi-major axis of the orbit of the innermost one, Io, at 421,800 kilometers.
And possibly if the masses of the moons are multiplied several times to make them massive enough to be habitable, that might increase the forbidden zones of the moons and require them to be more widely spaced. And of course if the outermost moons orbit too far from the planet, they are likely to have unstable orbits and be lost into interplanetary space.
So a writer who wants to have four habitable moons orbiting a giant planet in the habitable zone of their planet needs to study scientific studies of the possibility of habitable exomoons.
Part Four: Cohorts of Coorbital planets.
Astrophysicist Sean Raymond's PlanetPlanet blog has a section, the Ultimate Solar System, where Raymond tries designing imaginary stars systems with as many habitable worlds with stable orbits as possible.
https://planetplanet.net/the-ultimate-solar-system/
In this post:
https://planetplanet.net/2017/05/03/the-ultimate-engineered-solar-system/
Raymond mentions a paper by Smith and Lisseaur
https://ui.adsabs.harvard.edu/abs/2010CeMDA.107..487S/abstract
claiming that 7 to 42 planets of equal mass can share a single orbit around a star if they are equally spaced.
So in the rest of that post Raymond designs star systems with several orbits each containing a ring of many equally spaced habitable planets.
Note that Raymond says that:
I can only think of one way our 416-planet system could form. It must have been purposely engineered by a super-intelligent advanced civilization. I’m calling it the Ultimate Engineered Solar System.
In another post Raymond discusses incomplete planetary rings around a star, orbits which don't have planets equally space all the way around the star but only along a section of the orbit.
https://planetplanet.net/2020/11/19/cohorts/
And apparently Raymond's simulations show a cohort of coorbital planets can be stable along an arc of a planetary orbit, if the planets are spaced sufficiently far apart.
So presumably you could have four planets sharing an orbit as a cohort of four planets in a single segment of the orbit or as two cohorts of two planets each in two different segments of the orbit.