Artificial intelligence technology has become an important part of the development of Internet technology. Artificial intelligence technology can help colleges and universities optimize the network ideological and political teaching system. Artificial intelligence technology provides more accurate data resources and rich and reliable educational technology means for online public mental health education in colleges and universities. This paper comprehensively uses a variety of methods such as qualitative and quantitative analysis, case and empirical analysis, literature analysis, and artificial intelligence technology. Artificial intelligence technology has been closely integrated with online public mental health education in colleges and universities. The model systematically analyzes the optimization methods of artificial intelligence technology methods for the online public mental health education system in colleges and universities, and constructs an innovation system for online public mental health education in colleges and universities. Based on the comprehensive analysis of artificial intelligence and public health in colleges and universities, this paper further proposes the application of artificial intelligence technology in online public mental health education in colleges and universities. On this basis, the model conducts an in-depth analysis of artificial intelligence technology and the online public mental health innovation system. The model supports the development of ideological and political teaching in colleges and universities through various forms such as idea innovation, path innovation, carrier innovation, and mechanism innovation.