A dynamic procedure is developed to compute the model coefficients in the recently introduced modulated gradient models for both momentum and scalar fluxes. The magnitudes of the subgrid-scale (SGS) stress and the SGS flux are estimated using the local equilibrium hypothesis, and their structures (relative magnitude of each of the components) are given by the normalized gradient terms, which are derived from the Taylor expansion of the exact SGS stress/flux. Previously, the two model coefficients have been specified on the basis of theoretical arguments. Here, we develop a dynamic SGS procedure, wherein the model coefficients are computed dynamically according to the statistics of the resolved turbulence, rather than provided a priori or ad hoc. Results show that the two dynamically calculated coefficients have median values that are approximately constant throughout the turbulent atmospheric boundary layer (ABL), and their fluctuations follow a near log-normal distribution. These findings are consistent with the fact that, unlike eddy-viscosity/diffusivity models, modulated gradient models have been found to yield satisfactory results even with constant model coefficients. Results from large-eddy simulations of a neutral ABL and a stable ABL using the new closure show good agreement with reference results, including wellestablished theoretical predictions. For instance, the closure delivers the expected surface-layer similarity profiles and power-law scaling of the power spectra of velocity and scalar fluctuations. Further, the Lagrangian version of the model is tested in the neutral ABL case, and gives satisfactory results.