Auto-translated
I think such a tournament should initially be held using a Swiss-system format with elimination rounds. As soon as the number of players remaining in the tournament corresponds to the number of qualifying places, the tournament should end immediately.
In this situation, everyone who is still participating in the tournament has a chance to qualify; they simply need to win all the remaining matches.