We examine the impact of the competitive “STEM track choice”—a defining institutional feature of a number of national education systems—on gender gaps in STEM majors and college access. Many national education systems require high school students to make a largely irreversible, competitive choice between STEM and non-STEM tracks. This choice determines whether students will compete with STEM or non-STEM track students for college entrance. Using two datasets from China, we show that differences in how girls and boys make this choice are important reasons that girls select out of STEM, independent of gender differences in preference or ability. Specifically, we find that girls are more likely to choose their track by comparing their own STEM and non-STEM abilities (their “comparative advantage”) whereas boys are more likely to base their decision on how their STEM ability compares to others (their “absolute advantage”). Because girls often score higher in non-STEM subjects, looking at comparative advantage leads girls who would be competitive in the STEM track to nevertheless choose the non-STEM track. We further show that choosing the non-STEM track decreases the chance that these girls access college and elite colleges. Thus, the STEM track choice not only leads to gender imbalance in the number of STEM graduates but also to gender inequality in college access.