Just to add some details to Paul's answer:

It is indeed correct that the $k$-th Betti number of a compact Riemannian manifold $M$ without boundary is equal to the dimension of the space of harmonic $k$-forms. This is the Hodge isomorphism theorem. A good proof of this may be found in Demailly's book (available for free [here][1]) at the beginning of chapter 6.

Basically what happens is this: we use a Riemannian metric to define an inner product on the space $E^k := C^\infty(M, \bigwedge^k T_M^*)$ of smooth $k$-forms on $M$. The Riemannian metric also gives us the Laplacian $\Delta$, which turns out to be an elliptic differential operator on $E^k$. Thus we get an orthogonal direct sum decomposition

$$C^\infty(M, \bigwedge^k T_M^*) = \mathcal H^k(M) \oplus Im \Delta = \mathcal H^k(M) \oplus Im d \oplus Im d^{*}$$

where $\mathcal H^k(M) := Ker \Delta$ is the space of harmonic $k$-forms on $M$, and $d^{*}$ is the formal adjoint of the exterior derivative $d$. The subspace of $d$-closed forms of $E^k$ is exactly $\mathcal H^k(M) \oplus Im d$, and thus we obtain an isomorphism between $\mathcal H^k(M)$ and the $k$-th De Rham cohomology group $H^k(M,\mathbb{R})$, whose dimension is equal to the $k$-th Betti number of $M$.

Morally speaking this isomorphism is interesting because it gives a link between the topological and geometric structures of the manifold. The Betti numbers only depend on the topology of $M$, while the space of harmonic forms is defined by a Riemannian metric. With this theorem we can interpret the $k$-th Betti number as counting the number of linearly independent harmonic $k$-form on the original manifold. In particular, as you say, if a $k$-th Betti number is zero, then the only harmonic $k$-form on $M$ is the zero form. 


  [1]: https://www-fourier.ujf-grenoble.fr/~demailly/manuscripts/agbook.pdf