If you want an abstract criterion, it is known that a finitely generated profinite group is uniquely determined by its finite quotients (this is Theorem 3.2.9 of Ribes Zalesskii: if $G_1$ is a finitely generated profinite group, and $G_2$ is a profinite group with the same finite quotients, then $G_1\cong G_2$). Of course, if $G_1$ has rank $r$, then all finite quotients of $G_1$ will have rank $r$.
Conversely, suppose $G$ is a profinite group such that every quotient has rank $\leq r$ (and some quotient of rank $r$). By a diagonalization argument, we may find $r$ elements of $G$ such that the image in any finite quotient of $r$ is a set of generators. Thus, these elements form a topological generating set for $G$.
Thus, $rank(G)$ is the supremum of ranks of finite quotients of $G$.