The spikes in the inertial sensor data have been found to impact on the retrieval of the non-gravitational signals and the evaluation of the inertial sensor performance. Removing the spikes in the inertial sensor is critical for studies of gravitational reference sensors in space-based gravitational wave detection missions and accelerometers in gravity satellite missions. Thanks to a long period of inertial sensor data without thruster spikes, we can conduct machine learning based on this data to remove spikes. In this paper, a machine learning model called bi-directional long short-term memory (Bi-LSTM) neural network was built based on the inertial sensor data of TianQin-1 (TQ-1) mission. We use the machine learning method to remove the spikes in the inertial sensor data. After removing the spikes in the inertial sensor data, acceleration noise is suppressed form 2.0×10−7ms−2Hz−1/2 to the 2.8×10−10ms−2Hz−1/2 at 0.1 Hz, which is far better than the existing methods, including the linear interpolation, data substitution and mean value of adjacent data.