We investigate the influence of dark energy on structure formation, within five different cosmological models, namely a concordance Λ cold dark matter model, two models with dynamical dark energy, viewed as a quintessence scalar field [using a Ratra and Peebles (RP) and a supergravity (SUGRA) potential form], and two extended quintessence models (EQp and EQn), where the quintessence scalar field interacts non-minimally with gravity (scalar–tensor theories). We adopted for all models the normalization of the matter power spectrum σ8 to match the cosmic microwave background data. In the models with dynamical dark energy and quintessence, we describe the equation of state with w0≈−0.9, still within the range allowed by observations. For each model, we have performed hydrodynamical simulations in a cosmological box of (300 Mpc h−1)3 including baryons and allowing for cooling and star formation. The contemporary presence of evolving dark energy and baryon physics allows us to investigate the interplay between the different background cosmology and the evolution of the luminous matter. Since cluster baryon fraction can be used to constrain other cosmological parameters such as Ωm, we also analyse how dark energy influences the baryon content of galaxy clusters. We find that in models with dynamical dark energy, the evolving cosmological background leads to different star formation rates and different formation histories of galaxy clusters, but the baryon physics is not affected in a relevant way. We investigate several proxies of the cluster mass function based on X-ray observables like temperature, luminosity, Mgas and Ygas. We conclude that the X-ray temperature and Mgas functions are better diagnostic to disentangle the growth of structures among different dark energy models. We also evaluate the cosmological volumes needed to distinguish the dark energy models here investigated using the cluster number counts (in terms of the mass function and the X-ray luminosity and temperature functions). Relaxed, massive clusters, when studied in regions sufficiently far from the centre, are built up in a very similar way despite the different dark energy models here considered. We confirm that the overall baryon fraction is almost independent of the dark energy models at a few per cent level. The same is true for the gas fraction. This evidence reinforces the use of galaxy clusters as cosmological probe of the matter and energy content of the Universe.