Variations in fault currents, short times to clear the fault, and a lack of a natural current zero-crossing point are the most important challenges that DC microgrid protection faces. This challenge becomes more complicated with the presence of electric vehicles and energy storage systems due to their uncertainties. For this reason, in this paper, a new method for fault detection in DC microgrids with the presence of electric vehicles and energy storage systems is proposed. The new proposed method uses the combination of dynamic mode decomposition and instantaneous frequency for fault detection. In this method, first, a reference signal is made using the voltage and current signal sampled from the DC microgrid using the dynamic mode decomposition method. Next, in order to detect the fault, the instantaneous frequency value of the reference signal is calculated by the Hilbert transform. The simultaneous use of voltage and current signals reduces the transient effects of the control system on the proposed protection method. In order to measure voltage and current signals, only one intelligent electronic device unit is used in this paper. The proposed new method has been tested on a single-bus DC microgrid with the presence of electric vehicles and energy storage systems in MATLAB 2019b software. The results show that this method can detect all types of faults in DC microgrids, electric vehicles, and photovoltaics. Also, this method is immune to the uncertainties of the generation of distributed generation resources and the existence of noise distortions in the measured signals.