Terahertz (THz) lenses have numerous applications in imaging and communication systems. Currently, the common THz lenses are still based on the traditional design of a circular convex lens. In this work, we present a method for the design of a 3D-printed multilevel THz lens, taking advantage of the benefits offered by 3D printing technology, including compact size, lightweight construction, and cost-effectiveness. The approach utilizes an inverse design methodology, employing optimization methods to promise accurate performance. To reduce simulation time, we employ the finite-difference time-domain method in cylindrical coordinates for near-field computation and couple it with the Rayleigh-Sommerfeld diffraction theory to address far-field calculations. This technology holds great potential for various applications in the field of THz imaging, sensing, and communications, offering a novel approach to the design and development of functional devices operating in the THz frequency range.