In order to improve the output accuracy of fiber optic gyroscope, a BAS-BP-Bagging temperature compensation model is established by using a BP neural network model optimized by the beetle antennae search algorithm (BAS) as the base learner and a Bagging parallel ensemble learning algorithm, and a temperature compensation experiment is conducted for a model of fiber optic gyroscope. The experimental results show that the temperature drift of the fiber optic gyroscope after compensation is reduced by nearly 80% compared with that before compensation, 55% compared with the polynomial compensation algorithm, and about 30% compared with the BP neural network compensation algorithm under the temperature change environment from -40℃ to +60℃. And the model shows superior generalization performance in the compensation of fresh samples.