Terahertz wave has attracted significant attention in recent years, and terahertz devices have been applied in various fields. However, the complicated and time-consuming spectrum prediction and structure design issues have hindered the widespread application of terahertz science. In this work, we propose a new method to use neural networks to predict the reflection spectrum in the terahertz band, and more importantly, design a micro-nano structure with an on-demand optical response. To verify the effectiveness, we select a terahertz metasurface as an example for discussion. After the neural networks are trained, the spectrum prediction can achieve high precision, and the neural network also has encouraging performance when solving the design problem of micro-nano structure. Furthermore, we conclude that we can choose structure design neural networks with different complexity to satisfy different demands, and can optimize the networks to improve accuracy. Our work demonstrates that such a data-driven neural network can be applied to study the prediction and design problem of metasurface in the terahertz band and provide more opportunities for the terahertz devices in the future.