A D-dimensional gravitational model with a Gauss–Bonnet term and the cosmological term Λ is studied. We assume the metrics to be diagonal cosmological ones. For certain fine-tuned Λ , we find a class of solutions with exponential time dependence of two scale factors, governed by two Hubble-like parameters H> 0 and h, corresponding to factor spaces of dimensions 3 and l> 2 , respectively and D= 1 + 3 + l. The fine-tuned Λ = Λ (x, l, α) depends upon the ratio h/ H= x, l and the ratio α= α2/ α1 of two constants (α2 and α1) of the model. For fixed Λ , α and l> 2 the equation Λ (x, l, α) = Λ is equivalent to a polynomial equation of either fourth or third order and may be solved in radicals (the example l= 3 is presented). For certain restrictions on x we prove the stability of the solutions in a class of cosmological solutions with diagonal metrics. A subclass of solutions with small enough variation of the effective gravitational constant G is considered. It is shown that all solutions from this subclass are stable. © 2018, The Author(s).