Optical frequency comb (OFC) has important applications in measurement, communication, military and other fields. Usually, OFC needs to be designed according to different applications. However, the existing methods to design the operating parameters of the OFC generators are time-consuming, inefficient, and difficult to achieve optimal results. In this paper, a novel method of inversely designing OFC using deep learning, which is real-time and can improve the performance of the generated OFC, is proposed and applied to an OFC generator based on a single dual-drive Mach-Zehnder modulator. In this method, according to the required target OFC, the trained neural network can be used to inversely design the corresponding parameters. Using this inverse design method, the generated OFC not only is highly consistent with the target OFC, but also has the programmability of comb-line number, comb-line power, side mode suppression ratio, and comb spacing. Moreover, the proposed method can be utilized for more complicated OFC generator, and is an inspiration for efficient design of OFC.