Earlier quoted context omitted.
Just make tests hard enough so that you wouldn't need lottery
any tests will always be gamed by those with the resources to game them. either ethically (through special tutors and private programs) or unethically (cheating).
Standardized testing is a good predictor. In my country people are admitted based on standardized testing only (country wide subject exams and sat-like test) or results of university-adjacent "preparation courses" and it works fairly well. The affirmative action is realized directly as a bonus points to your scores based on the background, which reduces the effect of ethical gaming.