We present results of Swift optical, ultraviolet (UV) and X-ray observations of the afterglow of GRB 050801. The source is visible over the full optical, UV and X-ray energy range of the Swift Ultraviolet and Optical Telescope and X- ray telescope instruments. Both optical and X- ray light curves exhibit a broad plateau (Delta t/t similar to 1) during the first few hundred seconds after the gamma-ray event. We investigate the multiwavelength spectral and timing properties of the afterglow, and we suggest that the behaviour at early times is compatible with an energy injection by a newly born magnetar with a period of a few tenths of a millisecond, which keeps the forward shock refreshed over this short interval by irradiation. Reverse shock emission is not observed. Its suppression might be due to GRB ejecta being permeated by high magnetic fields, as expected for outflows powered by a magnetar. Finally, the multiwavelength study allows a determination of the burst redshift, z = 1.56.