Stellar magnetism plays an important role in stellar evolution theory. Approximatively 10 per cent of observed main sequence (MS) and pre-main-sequence (PMS) radiative stars exhibit surface magnetic fields above the detection limit, raising the question of their origin. These stars host outer radiative envelopes, which are stably stratified. Therefore, they are assumed to be motionless in standard models of stellar structure and evolution. We focus on rapidly rotating, radiative stars which may be prone to the tidal instability, due to an orbital companion. Using direct numerical simulations in a sphere, we study the interplay between a stable stratification and the tidal instability, and assess its dynamo capability. We show that the tidal instability is triggered regardless of the strength of the stratification (Brunt–Väisälä frequency). Furthermore, the tidal instability can lead to both mixing and self-induced magnetic fields in stably stratified layers (provided that the Brunt–Väisälä frequency does not exceed the stellar spin rate in the simulations too much). The application to stars suggests that the resulting magnetic fields could be observable at the stellar surfaces. Indeed, we expect magnetic field strengths up to several Gauss. Consequently, tidally driven dynamos should be considered as a (complementary) dynamo mechanism, possibly operating in radiative MS and PMS stars hosting orbital companions. In particular, tidally driven dynamos may explain the observed magnetism of tidally deformed and rapidly rotating Vega-like stars.