We study the topology of the space Ωp of admissible paths between two points e (the origin) and p on a step-two Carnot group G:As it turns out, Ωp is homotopy equivalent to an infinite dimensional sphere and in particular it is contractible. The energy function:is defined by J(γ) = 1 2 I γ 2 ; critical points of this function are sub-Riemannian geodesics between e and p. We study the asymptotic of the number of geodesics and the topology of the sublevel sets:the number of geodesics joining e and p is bounded and the homology of Ω s p stabilizes to zero for s large enough. A completely different behavior is experienced for the generic vertical p. In this case we show that J is a Morse-Bott function: geodesics appear in isolated families (critical manifolds), indexed by their energy. Denoting by l the corank of the horizontal distribution on G, we prove that: Card{Critical manifolds with energy less than s} ≤ O(s) l . Despite this evidence, Morse-Bott inequalities b(Ω s p ) ≤ O(s) l are far from being sharp and we show that the following stronger estimate holds: b(Ω s p ) ≤ O(s) l−1 . Thus each single Betti number bi(Ω s p ) (i > 0) becomes eventually zero as s → ∞, but the sum of all of them can possibly increase as fast as O(s) l−1 . In the case l = 2 we show that indeed b(Ω s p ) = τ (p)s + o(s) (l = 2). The leading order coefficient τ (p) can be analytically computed using the structure constants of the Lie algebra of G.Using a dilation procedure, reminiscent to the rescaling for Gromov-Hausdorff limits, we interpret these results as giving some local information on the geometry of G (e.g. we derive for l = 2 the rate of growth of the number of geodesics with bounded energy as p approaches e along a vertical direction).