Poor teaching effectiveness is currently a major concern at China's colleges and universities. The 5G Internet age has delivered massive advancements to lifestyle, culture, and work, and its convenience and efficacy have aided civilization's express advancement. It has brought with it a host of difficulties, as well as new changes and benefits for university students' ideological and political education (IPE). However, the Internet's openness and dispersion have certain negative repercussions, especially in terms of IPE in institutions, where the consequences are significant. In this paper, we have proposed a 5G-based IPE. In the opening, we collect the dataset to initialize the proposed flow. The collected dataset can be pre-processed using normalization. After the input education details have been preprocessed, the education detail is grouped by utilizing the Hierarchical K-means technique. The aspects can then be extracted using the variational autoencoder (VAE). After it has been reviewed for viability, the data can be stored in a database for future research. Then, using the Boosted TCP protocol (BTCP), the workable data can be sent to the identity of the student, and also the BTCP used to convert data effectively. The presentation of this protocol improved using Enhanced fruit fly optimization (EFFO). Performances such as throughput, good-put, transmission rate, and execution time are examined, and the results are compared to those of other studies.