In this paper are discussed the causes of artifacts appearing in the 24 hours' dynamic electrocardiogram. Then a new method based on the least square algorithm to discriminate the artifacts is proposed. Finally, the artifacts in the electrocardiogram (ECG) data collected from the hospital are analyzed. The results of experiment show that it is possible to quickly and effectively discriminate the artifacts caused by trembling, ill contact of electrode, and motion. The new method is conducive to ensuring clinicians' correct judgment of dynamic electrocardiogram signals.