ObjectivePredict long-term disease worsening and the removal of biosimilar medication in patients with rheumatic diseases.MethodologyObservational, retrospective descriptive study. Review of a database of patients with immune-mediated inflammatory rheumatic diseases who switched from a biological drug (biosimilar or non-biosimilar) to a biosimilar drug for at least 6 months. We selected the most important variables, from 18 variables, using mutual information tests. As patients with disease worsening are a minority, it is very difficult to make models with conventional machine learning techniques, where the best models would always be trivial. For this reason, we computed different types of imbalanced machine learning models, choosing those with better f1-score and mean ROC AUC.ResultsWe computed the best-imbalanced machine learning models to predict disease worsening and the removal of the biosimilar, with f1-scores of 0.52 and 0.63, respectively. Both models are decision trees. In the first one, two important factors are switching of biosimilar and age, and in the second, the relevant variables are optimization and the value of the initial PCR.ConclusionsBiosimilar drugs do not always work well for rheumatic diseases. We obtain two imbalanced machine learning models to detect those cases, where the drug should be removed or where the activity of the disease increases from low to high. In our decision trees appear not previously studied variables, such as age, switching, or optimization.Key points-This is a real-life study of a large number of patients with biosimilar bDMARDs.-Biosimilar drugs can be considered effective in rheumatic inflammatory diseases, as measured by ASDAS, DAPSA and DAS28.-The bDMARDs biosimilars are safe drugs with a low number of side effects.-After switching from the reference drug to a biosimilar drug, patients have a high withdrawal rate due to ineffectiveness.-Our machine learning model (imbalanced machine learning) is able to predict when drug withdrawal and disease activity occur.