Identifying the magnetic state of materials is of great interest in a wide range of applications, but direct identification is not always straightforward due to limitations in neutron scattering experiments. In this work, we present a machine-learning approach using decision-tree algorithms to identify magnetism from the spin-integrated excitation spectrum, such as the density of states. The dataset was generated by Hartree-Fock mean-field calculations of candidate antiferromagnetic orders on a Wannier Hamiltonian, extracted from first-principle calculations targeting BaOsO3. Our machine learning model was trained using various types of spectral data, including local density of states, momentum-resolved density of states at high-symmetry points, and the lowest excitation energies from the Fermi level. Although the density of states shows good performance for machine learning, the broadening method had a significant impact on the model's performance. We improved the model's performance by designing the excitation energy as a feature for machine learning, resulting in excellent classification of antiferromagnetic order, even for test samples generated by different methods from the training samples used for machine learning.