Longitudinal Data

Can XGBoost decision tree bagging tree ensemble be used for longitudinal (serial) data measurements? For instance, I am using the model to make predictions from a patient data set of 40 patients, with about 10 separate spectral measurements at different time points for each patient. Since the measurements from the same patients are correlated, the samples are not independent. Does this affect the accuracy of the predictions on a random test subset? If so, is there an approach to account for serial measurements?