A pacemaker provided with a mode switching feature adapted to stabilize ventricular heart rate during atrial fibrillation. In a preferred embodiment of the invention, the device nominally operates in an atrial synchronized pacing mode such as DDD, DDDR, VDD or VDDR. In response to detection of atrial rhythm characteristics consistent with atrial fibrillation, the device switches into a non-atrial synchronized, ventricular rate stabilization pacing mode with the base ventricular pacing rate modulated on a beat by beat basis based upon preceding intrinsic or paced ventricular heartbeat intervals to adjust the pacing interval towards a desired preset rate stabilization target pacing interval which is typically less than the programmed base pacing interval of the device. While the ventricular rate stabilization mode is in effect, the current pacing interval is set equal to the preceding intrinsic or paced interval, with an increment if the preceding interval is less than the desired or target pacing interval, as typically will be the case, or with a decrement if the preceding interval is greater than the desired pacing interval. In a preferred embodiment of the invention, the device paces both the atria and ventricles in a DDI rate stabilization pacing mode with the ventricular pacing interval being modulated.