The frailty index (FI) is one of the most widespread tools used to predict poor, health-related outcomes in older persons. The selection of clinical and functional deficits to include in a FI is mostly based on the users’ clinical experience. However, this approach may not be sufficiently accurate to predict health outcomes in particular subgroups of individuals. In this study, we implemented an optimization algorithm, the genetic algorithm, to create a highly performant (FI) based on our prediction goals, rather than on a predetermined clinical selection of deficits, using data from the Swedish National Study on Aging and Care in Kungsholmen (SNAC-K) and 109 potential deficits identified in the dataset. The algorithm was personalized to obtain a FI with high discrimination ability in the prediction of mortality. The resulting FI included 40 deficits and showed areas under the curve consistently higher than 0.80 (range 0.81-0.90) in the prediction of 3-year and 6-year mortality in the whole sample and in sex and age subgroups. This methodology represents a promising opportunity to optimize the exploitation of medical and administrative databases in the construction of clinically relevant frailty indices.