TDLAS/WMS-based oxygen detection has been proven to be an effective method for the sealability verification of encapsulated pharmaceutical vials of sterile preparations. However, under the actual aseptic preparation filling production mill, it is not easy to maintain high oxygen detection precision due to the multiple irritating noises from both the environment (e.g., temperature, moderation, vibration) and the detection system itself (e.g., laser, circuits). This paper proposes a novel dynamic sparse residual oxygen prediction method for pharmaceutical vials under TDLAS/WMS framework. On the one hand, we directly feed the decomposed wavelet sub-components to the prediction model, other than reconstructing them back to the time domain after some filtering measures in the wavelet domain. Then the fine-grained signal descriptive advantage of wavelet transform is preserved, and the rough reconstruction is dropped, instead by the adaptive feature selection managed by the subsequent classification model. On the other hand, to deal with the large data volume gathered from the high-speed production, we introduce the L1-norm to the target function of LSSVM, where sample-sparsity is added to the prediction model innovatively. Thus, by assigning more weight to valuable samples, the influence of environmental interference on prediction decision-making is weakened. Consequently, sample-sparsity and feature-sparsity are realized simultaneously to track the dynamic environmental variation. Experimental results show that the proposed method yields higher average accuracy than others, and provides a referred choice to suppress the inevitable detection interferences, not only from hardware and optical optimization but also from a signal processing perspective.