Some of the largest and best-preserved Buddhist art treasure houses in the world, namely the Mogao Grottoes, are located at the northwest edge of the region of the Qinghai-Tibet plateau and are adjacent to the Altun and Qilian mountains, where the geotectonic activity is intense and large earthquakes have occurred. Future earthquakes are one of the major threats to the caves of the Mogao Grottoes; therefore, it is important that their dynamic performance is studied when an earthquake occurs. To understand the dynamic performance of the densely distributed caves under the effect of earthquakes, as well as the long-term stability of the Mogao Grottoes, the stress distribution, deformation characteristics, and peak-acceleration amplification factor were analysed under rare-earthquake conditions using a finite-difference element. The numerical study revealed that the most dangerous state of the caves is the initial time when an earthquake occurs. The obvious tensile stress concentration appeared at the top and the bottom of the caves of the middle floor; the main damage was caused by the shear failure towards the direction of the free face and not by the tensile failure. A large permanent horizontal displacement of the caves occurred after an earthquake, mostly at the densely distributed caves of the middle floor. The acceleration amplification effect of the middle-floor caves was significant; the Fourier amplitudes of the acceleration (which were monitored in all caves) were significantly magnified at the frequencies of 3 ~ 4 Hz and 7 ~ 9 Hz, whereas the Fourier amplitudes of the acceleration which were monitored in the middle-floor caves were almost amplified within the entire frequency range. Although the maximum stress was within the allowed limit and no tensile failure occurred, great permanent inhomogeneous horizontal displacements and large accelerations could have a negative effect on the stability of caves and the preservation of wall paintings. Moreover, it was assumed that the calculation results could serve as a type of guidance and as advice on the preventive protection of the Mogao Grottoes.