In the era of artificial intelligence, algorithmic recommendation technology has reshaped the information dissemination pattern, promoted structural changes in the communication paradigm, and brought new contextual challenges to ideological and political education. The study proposes a knowledge tracking model F-TCKT that integrates the forgetting factor and the attention mechanism, uses TCN to process the historical interaction information of students’ ideological and political learning, and integrates the information of sequential features of different sizes through the attention mechanism to realize the modeling of students’ ideological and political level. On this basis, the recommendation process of Civics resources is transformed into a Markov decision process and modeled using a dual DQN model to improve the recommendation accuracy of Civics resources.The F-TCKT model improves the most on the ASSISTments2015 dataset, with the AUC value and the Acc value improved by 19.37 and 10.97 percentage points compared with DKT. At the same time, the recommendation effect gradually improves and stabilizes with the number of trainings, which can recommend the Civics resources according to the answering state at a certain moment, and realize the rapid improvement of students’ Civics cognitive ability in a shorter period of time.