The objective of this retrospective longitudinal study was to evaluate the relationship between dry period length and the production of milk, fat, protein, lactose and total milk solids in the subsequent lactation of Holstein dairy cows under tropical climate. After handling and cleaning of the data provided by the Holstein Cattle Breeders Association of Minas Gerais, data from 32 867 complete lactations of 19 535 Holstein animals that calved between 1993 and 2017 in 122 dairy herds located in Minas Gerais state (Brazil) were analysed. In addition to dry period length, calving age, lactation length, milking frequency, parity, calf status at birth, herd, year, and season of calving were included in the analysis as covariables to account for additional sources of variation. The machine learning algorithms gradient boosting machine, extreme gradient boosting machine, random forest and artificial neural network were used to train models using cross validation. The best model was selected based on four error metrics and used to evaluate the variable importance, the interaction strength between dry period length and the other variables, and to generate partial dependency plots. Random forest was the best model for all production outcomes evaluated. Dry period length was the third most important variable in predicting milk production and its components. No strong interactions were observed between the dry period and the other evaluated variables. The highest milk and lactose productions were observed with a 50-d long dry period, while fat, protein, and total milk solids were the highest with dry period lengths of 38, 38, and 44 d, respectively. Overall, dry period length is associated with the production of milk and its components in the subsequent lactation of Holstein cows under tropical climatic conditions, but the optimum length depends on the production outcome.