In this paper, an ingenious reverse design method is applied to the design and optimization of terahertz bandpass filters in order to achieve standardized design of high-performance terahertz functional devices. An equivalent model of subwavelength metasurface mapped to digital space is established. Based on ideal objective functions and constraints, intelligent algorithms begin a bold journey to explore the vast potential structure in the solution space. Through iterative refinement, the algorithm reveals optimal structural patterns, unlocking areas of unparalleled performance. The direct binary search (DBS) algorithm and the binary particle swarm optimization (BPSO) algorithm are compared in optimization process. When using the DBS algorithm to optimize the design area, it takes a long time to poll the logic states of all pixel units point by point, and it is easy to get stuck in the local optimal value. However, BPSO algorithm has stronger global search capabilities, faster convergence speed, and higher accuracy. Through a comprehensive comparison of the device performance optimized by the two algorithms, the solution optimized by BPSO algorithm has better out-of-band suppression performance and a narrower full width at half peak, but slightly lower transmittance at the center frequency. The bandpass filter has a center frequency of 0.51 THz, a bandwidth of 41.5 GHz, and an insertion loss of -0.1071 dB. When considering computational efficiency, DBS algorithm lags behind, the simulation time is 11550 s, while BPSO algorithm only needs 9750 s. Compared with the traditional forward design, the reverse design method can achieve the narrower band, lower insertion loss, better out-of-band suppression and polarization stability. The fine structural changes of the optimal results have a significant influence on spectral performance, demonstrating the superiority and uniqueness of reverse design. This technology contributes to the design and optimization of high-performance and novel functional devices.