The management of orbital angular momentum (OAM) in frequency conversion processes is essential for numerous applications such as quantum and classical optical communications. This paper presents a wavefront modulation approach for the fundamental beam in second harmonic generation (SHG) to efficiently control the OAM spectrum. We employ an inverse design method to derive the necessary wavefront shape of the fundamental beam for achieving a desired SHG OAM spectrum. Specifically, we introduce an efficient inverse design technique based on physics-guided neural networks (PGNNs) that incorporates the coupled equations governing SHG, aimed at tailoring the OAM spectrum of SHG. Utilizing the proposed PGNN, we design the phase pattern for a spatial light modulator (SLM) to shape the wavefront of the fundamental beam. Furthermore, we present a novel loss function, to our knowledge, that effectively links the OAM of the SHG spectrum and efficiency to the SLM phase pattern and crystal temperature, independent of empirical weight coefficients. The proposed PGNN facilitates the purification of the SHG OAM spectrum, even when the fundamental beam comprises mixed Laguerre–Gaussian (LG) modes. Additionally, we demonstrate the generation of desired SHG spectra using the proposed PGNN framework. This study introduces what we believe to be a groundbreaking inverse design method for developing photonic devices with customized functionalities, addressing challenges associated with traditional data-driven deep learning techniques.