Short Answer:
The most stars in a known system are seven, and eight seems like the theoretical maximum. But it is possible that in extreme situations stable systems with more than seven stars might be theoretically possible.
Long Asnwer:
Part One of Four: Stable Star Systems are Hierarchical.
In stable star systems the orbits of individual stars and pairs of stars are arranged in a hierarchical order.
See: https://en.wikipedia.org/wiki/Star_system#Hierarchical_systems[1]
The two stars in a pair will orbit each other more closely than any other pairs or single stars will. A planet or star or pair of stars will have to orbit a pair of stars at a distance of at least a few times their separation in order to have a stable orbit. That is the reason for the hierarchical orbit types discussed in the article.
Part two: The Ultimate solar System and its limits.
There is a blob by astronomer Sean Raymond called PlanetPlanet, with a section called The Ultimate Solar System, where Raymond designs plausible imaginary solar systems, the goal to be a system with the maximum possible, though statistically very rare and improbable, number of habitable planets.
https://planetplanet.net/the-ultimate-solar-system/[2]
So Raymond tries putting the greatest possible number of planetary orbits inside the circumstellar habitable zone of a single star. He tries trojan systems, with two or three planets sharing an orbit. He tries putting giant planets in the circumstellar habitable zone of a star, with several giant moons large enough to be habitable orbiting each giant planet.
Then he tries assembling more and more stars into the system, each with as many habitable planets as possible.
In "part 6: A system with many stars" he designs his masterpice, a system with 16 stars arranged in a hierarchy of 8 binary stars arranged in 4 quatenary stars arranged in 2 octenary stars, and a total of 384 to 576 habitable worlds.
And in the next post, "The biggest tragedy in the history of the universe" he describes how such a solar system would be torn apart and most of the once habitable worlds collide with other planets, fall into a star, or be ejected into the cold of interstellar space.
The two 8 star systems making up the 16 star system would have to be spaced so far apart that galactic tital forces, and the gravity of passing star systems, would turn their once almost circular orbits more and more elliptical. This effect would trickle down to the four star systems and the pairs of stars, and eventually the orbits of all the planets would be disrupted.
Here is a link to an article on the subject:
https://www.sciencedaily.com/releases/2013/01/130106145751.htm[3]
So if that is correct, a system with a four level hierarchy and with at most eight stars would seem to be the limit.
And as a matter of fact, the two known systems with the most stars are believed to be septenary systems with seven stars, Nu scorpii and AR Cassiopeiae.
https://en.wikipedia.org/wiki/Nu_Scorpii[4]
https://en.wikipedia.org/wiki/AR_Cassiopeiae[5]
Part Three: Possible Exceptions.
I suggest that if a star system was alone in the universe, or at least floating in intergalactic space hundreds or thousands of light years or parsecs from the nearest other star, a system with many more than eight stars should be dynamically stable.
And Raymond spaced the stars in each basic binary pair of his ultimate solar system far enough apart that each star could have planets in its habitable zone. But if the stars in each pair were spaced a fraction that far, too close to have planets orbiting each star, then the two sets of eight stars could also orbit each other much closer, perhaps close enough to avoid disruption.
So if it is not required that the pairs of stars are spaced far enough apart to have plantary systems, the whole 16 star system might be tight enough to avoid disruption and have stable orbits. Of course such a vast solar system without any planets would seem like a waste to science fiction fans, but it might be physically possible.
Part Four: Rings of Stars.
However, there is one way way it is theoretically physically possible for a star system to have more than seven or eight stars in stable orbits.
"The Ultimate Engineered Solar System"
https://planetplanet.net/2017/05/03/the-ultimate-engineered-solar-system/[6]
features a star with a ring of planets sharing the same orbit. Actually several rings of planets in the stars habitable zone. Raymond says that between 7 and 42 astronomical objects can share a stable orbit if they have equal mass and are equally spaced along the orbit. An arrangement which would probably have to be created by a super advanced civiization instead of happening naturally.
His source is this paper:
https://ui.adsabs.harvard.edu/abs/2010CeMDA.107..487S/abstract[7]
And in another post: "The Million-Earth Solar System"
https://planetplanet.net/2018/06/01/the-million-earth-solar-system/[8]
Raymond designs a hypothetical system with a giant black hole with one million times the mass of the Sun, and with a ring of stars around it. In one version their is a ring of 9 stars and the many rings of habitable planets orbit the black hole outside the ring of stars. In another version there is a ring of 36 stars and the many rings of habitable planets orbit the black hole inside the ring of stars.
So theoretically a supermassive back hole could be orbited by one or more rings of normal mass stars, each ring having 7 to 42 stars.
Apart from that theoretical possibility, I think that probably 8 stars are the most possible in a naturally forming star system to have long term stability if that star system orbits within a galaxy and is subjected to strong tidal forces from other stars.