The mechanism of the selective dispersion of single-walled carbon nanotubes (CNTs) by polyfluorene polymers is studied in this paper. Using extensive molecular dynamics simulations, it is demonstrated that diameter selectivity is the result of a competition between bundling of CNTs and adsorption of polymers on CNT surfaces. The preference for certain diameters corresponds to local minima of the binding energy difference between these two processes. Such minima in the diameter dependence occur due to abrupt changes in the CNT's coverage with polymers, and their calculated positions are in quantitative agreement with preferred diameters reported experimentally. The presented approach defines a theoretical framework for the further understanding and improvement of dispersion/extraction processes.