The problem of network attacks is a primary focus in the domain of intrusion detection. Models face significant challenges in recognizing intrusion behaviors, particularly when dealing with high-dimensional and sparse datasets. Traditional machine learning methods often struggle with these dimensionality issues. In contrast, deep learning, a crucial technology in intrusion detection, excels at managing high-dimensional data. However, traditional image coding methods do not adequately address data sparsification and often overlook the spatial continuity among features. The Fourier transform is a promising solution for data sparsity issues, as it effectively mitigates the impact by converting data into a different domain. Inspired by the Fourier transform, this paper proposes a lightweight intrusion detection model called TFTKD, based on Convolutional Neural Networks (CNN) and knowledge distillation. The model applies a two-dimensional Fourier transform to convert grayscale images from the time domain to the frequency domain. This transformation enhances the similarity between neighboring pixels, effectively addressing data sparsification. During the training phase, a teacher network, comprising an 8-layer CNN, is pre-trained. In the distillation phase, a one-layer CNN serves as the student network, employing Self-adaptive Temperature Knowledge Distillation to enhance the student's generalization capabilities. This approach results in a compact student network model with a constrained parameter count, demonstrating superior learning efficiency and accuracy compared to state-of-the-art methods. Experimental validation was conducted using four publicly accessible intrusion detection datasets, demonstrating the effectiveness of the proposed method.