Nowadays, digital images are used as critical evidence for judgment, but they can be forged using image processing tools with invisible traces and little effort. Hence, it is very important to determine the authenticity of these digital images. In this paper, we propose a novel approach that uses dictionary learning and sparse coding to detect digital image forgery. We experimented with two popular data sets to determine how effectively and efficiently our approach detects digital image forgery compared to previous approaches. The results show that our approach not only outperforms these approaches in terms of Precision, Recall, and F1 score, but it is also more robust against compression and rotation attacks. Also, our approach detects forgery significantly faster than previous approaches since it uses a sparse representation that dramatically reduces the feature dimensionality by a factor of more than 20.