With the blowout of electric vehicles recently, the key parts of the electric vehicles driven by in-wheel motors named the electric wheel system become the core of development research. The torque ripple of the in-wheel motor mainly results in the longitudinal dynamics of the electric wheel system. The excitation sources are first analyzed through the finite element method, including the torque ripple induced by the in-wheel motor and the unbalanced magnetic pull produced by the relative motion between the stator and rotor. The accuracy of the finite element model is verified by the back electromotive force test of the in-wheel motor. Second, the longitudinal-torsional coupled dynamic model is established. The proposed model can take into account the unbalanced magnetic pull. Based on the model, the modal characteristics and the longitudinal dynamics of the electric wheel system are analyzed. The coupled dynamic model is verified by the vibration test of the electric wheel system. Two indexes, namely, the root mean square of longitudinal vibration of the stator and the signal-to-noise ratio of the tire slip rate, are proposed to evaluate the electric wheel longitudinal performance. The influence of unbalanced magnetic pull on the evaluation indexes of the longitudinal dynamics is analyzed. Finally, the influence of motor’s structural parameters on the average torque, torque ripple, and equivalent electromagnetic stiffness are analyzed through the orthogonal test. A surrogate model between the structural parameters of the in-wheel motor and the average torque, torque ripple, and equivalent electromagnetic stiffness is established based on the Bp neural network. The torque ripple and the equivalent electromagnetic stiffness are then reduced through optimizing the structural parameters of the in-wheel motor. It turns out that the proposed Bp neural network–based method is effective to suppress the longitudinal vibration of the electric wheel system.