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 finite quotient has rank $\leq r$ (and some finite quotient ofhas rank $r$). The set of finite quotients forms a lattice, since if one has epimorphisms $G\twoheadrightarrow A, G\twoheadrightarrow B$ where $A$ and $B$ are finite groups, then one has a map $G\twoheadrightarrow H\leq A\times B$, such that $G\twoheadrightarrow H\twoheadrightarrow A$ and $G\twoheadrightarrow H\twoheadrightarrow B$.
For any given finite quotient $G\twoheadrightarrow A$, consider the subset $Gen(A)\subset A^r$ consisting of $r$ elements which generate $A$. Since $A$ is finite, $Gen(A)$ is finite for all $G \twoheadrightarrow A$. By hypothesis, $Gen(A)$ is non-empty for all $G \twoheadrightarrow A$, and clearly if we have $G \twoheadrightarrow H \twoheadrightarrow A$ where $H$ is finite, then we have a diagonalization argumentmap $Gen(H) \twoheadrightarrow Gen(A)$.
Thus, we may findchoose for all $G \twoheadrightarrow A$ an $r$ elements of-tuple $G$$g(A)=(a_1,\ldots, a_r)\in Gen(A)$, such that if $G\twoheadrightarrow H \twoheadrightarrow A$, then $g(H)\mapsto g(A)$. This follows by the image in anylattice property of finite quotientquotients: we may find $G \twoheadrightarrow \cdots H_i \twoheadrightarrow \cdots \twoheadrightarrow H_2 \twoheadrightarrow H_1$ an inverse sequence of finite groups such that for any $r$$G \twoheadrightarrow A$, there exists $i$ such that $G \twoheadrightarrow H_i \twoheadrightarrow A$. Choose $g(H_i)$ inductively so that for each $j>i$, there exists $v\in Gen(H_j)$ such that $v\mapsto g(H_i)$. Then define $g(A)=\phi(g(H_i))$ for some $i$ such that there is a set of generatorsfactoring $G \twoheadrightarrow H_i \overset{\phi}{\twoheadrightarrow} A$. Thus Now, these elements formthe collection $\{ g(A), G \twoheadrightarrow A\}$ defines a unique $r$-tuple in $G$ which determines a topological generating set for $G$, since the cosets of the groups $ker\{G \twoheadrightarrow A\}$ form a neighborhood basis of $1\in G$, and therefore any nested sequence of cosets of $ker\{G \twoheadrightarrow A\}$ determines a unique element of $G$.
Thus, $rank(G)$ is the supremum of ranks of finite quotients of $G$.