Artificial intelligence (AI) advancements have radically altered human production and daily living. When it comes to AI's quick rise, it facilitates the growth of China's citizens, and at the same moment, a lack of intelligence has led to several concerns regarding regulations and laws. Current investigations regarding AI on legal knowledge do not have consistent benefits in predicting adolescents' psychological status, performance, etc. The study's primary purpose is to examine the influence of AI on the legal profession and adolescent mental health using a novel cognitive fuzzy K-nearest neighbor (CF-KNN). Initially, the legal education datasets are gathered and are standardized in the pre-processing stage through the normalization technique to retrieve the unwanted noises or outliers. When normalized data are transformed into numerical features, they can be analyzed using a variational autoencoder (VAE) approach. Multi-gradient ant colony optimization (MG-ACO) is applied to select a proper subset of the features. Tree C4.5 (T-C4.5) and fitness-based logistic regression analysis (F-LRA) techniques assess the adolescent's mental health conditions. Finally, our proposed work's performance is examined and compared with classical techniques to gain our work with the greatest effectiveness. Findings are depicted in chart formation by employing the MATLAB tool.