Again, you have kind of a chicken-and-egg problem here. Ability is typically measured by standardized testing, which is a poor proxy. The same way engineering interviews are a poor proxy for actually measuring engineering ability or ability to add value as an SDE.
Unfortunately, measuring ability this way also captures your socioeconomic status, family stability, medical conditions, and many other things that adversely impact your "ability" to perform well on a standardized test.
We could argue it's not on Princeton or other institutions to account for that, but as a society I think we could probably do better in that regard, by offering a variety of solutions to this complex problem.
Just offer different classes, with different difficulties. Some people will be bored and go to more advanced classes, others will struggle and move to less advanced classes.
There's actually a well-organised system that almost does this - primary school! Except that there, people are forcefully grouped by age, when there's really no need for that. That's (one of the reasons) why I advocate for mixed-age education.
This ability may vary wildly across subjects (maths vs biology vs history), and with time (acute cases of interest / commitment, or distracting factors like romance or gaming).
In any case, batching people by the level of current ability is helpful. This is a complete opposition to typical public schools, which batch kids by age and zip code. No wonder many of them dislike it and underachieve.