In recent years, the applications of the satellite have been more and more widespread. Fault diagnosis as the main research field in the satellite system has attracted much attention from the industrial and academic areas. The performance of the traditional fault diagnosis method is degraded significantly when the satellite system becomes more complex. Data driven based diagnosis method, which depends on the machine learning algorithm, has high flexibility in the complex and changeable system. In this paper, we propose a fault diagnosis and analysis method based on the nearest neighbor state and xgboost. In order to illustrate the performance of the proposed method, four experiments have been carried out. First, we construct a data set which can be used for model input based on the nearest neighbor state alignment method. The second experiment is based on the principal component analysis of the data that mines the data characteristics without the labels. Then the fault diagnosis model based on xgboost is implemented. The classification results show that the model can effectively shrink the error while the training process is still fast. In the final experiment, we mine the parameters that can better describe or cause the fault from the historical telemetry data of the satellite, which is of great significance for the operation and maintenance of the satellite in orbit.