Covalent triazine frameworks (CTFs), noted for their rich nitrogen content, have attracted significant attention as promising photocatalysts. However, the structural complexity introduced by the diversity of nitrogen atoms in nitrogen‐rich CTFs poses a substantial challenge in discovering high‐performance CTFs. To address this challenge, a machine‐learning approach is developed to rationally design nitrogen‐rich CTFs, which is subsequently validated through experimental methods. A framework is employed based on the special orthogonal group in three dimensions (SO(3))‐invariant graph neural networks to predict photocatalytic properties of CTFs structures. This approach achieves exceptionally high accuracies with R2 scores exceeding 0.98. From a dataset of 14920 CTFs structures, this framework identifies 45 high‐performance candidates. Guided by these predictions, a novel CTF structure, pyridine‐2,5‐dicarbaldehyde (CTF‐DCPD) is selected and successfully synthesized, which exhibits an ultrahigh hydrogen evolution rate of 17.70 mmol g−1 h−1. This rate significantly surpasses that of the widely studied CTF‐1,4‐dicyanobenzene (CTF‐DCB, 10.41 mmol g−1 h−1). This work provides a new paradigm for machine learning to accelerate materials development, which can be generalized to the development of other functional materials.