Developing efficient catalysts for nitrogen reduction reaction is a meaningful yet challenging endeavor. Here, we employ machine learning to screen for efficient Heusler alloy catalysts (X2YZ). We incorporate classification tasks into the graph neural network to differentiate between adsorbates and adsorption sites, thereby improving the network's ability to recognize adsorption configurations and enhance its predictive accuracy of adsorption energy simultaneously. Following training on an adsorption dataset of 6000 density-functional theory calculations, our model can predict the adsorption energies of critical adsorbates (N2, NNH, NH, NH2, H) with a mean absolute error of 0.1 eV. Through a multi-criteria screening, we identified a series of Ru-based Heusler catalysts with low limiting potentials and the ability to suppress hydrogen evolution reactions. For example, Ru2HfTl exhibits a low limiting potential of -0.32 V. Statistical analysis reveals that the average d-electron of X and Y elements, along with the group number of Z element, can assess the catalyst activity of Heusler alloys. Furthermore, we discover that the unique geometric structure of four-fold hollow sites on the (110) surface of Heusler alloy can facilitate N2 activation and alter the potential determining step of NRR.