Accreting white dwarfs are often found in close binary systems with orbital periods ranging from tens of minutes to several hours. In most cases, the accretion process is relatively steady, with significant modulations only occurring on timescales of ~days or longer1,2. Here we report the discovery of abrupt drops in the optical luminosity of the accreting white dwarf binary system TW Pictoris by factors up to 3.5 on timescales as short as 30 minutes. The optical light curve of this binary system obtained by the Transiting Exoplanet Survey Satellite (TESS) clearly displays fast switches between two distinct intensity modes that probably track the changing mass accretion rate onto the white dwarf. In the low mode, the system also displays magnetically gated accretion bursts3,4,5, which implies that a weak magnetic field of the white dwarf truncates the inner disc at the co-rotation radius in this mode. The properties of the mode switching observed in TW Pictoris appear analogous to those observed in transitional millisecond pulsars6,7,8,9,10, where similar transitions occur, although on timescales of ~tens of seconds. Our discovery establishes a previously unrecognized phenomenon in accreting white dwarfs and suggests a tight link to the physics governing magnetic accretion onto neutron stars.