Lemma. $\mathbb{F}(X)\simeq\mathbb{F}(Y)$ if and only if $|X|=|Y|$ in the sense of cardinal numbers.
Proof.
"$\Leftarrow$" Consider bijection $f:X\to Y$ and its inverse $g:Y\to X$. Compose them with inclusions to obtain $f':X\to\mathbb{F}(Y)$ and $g':Y\to\mathbb{F}(X)$. By the universal property of free groups these induce group homomorphisms $F:\mathbb{F}(X)\to\mathbb{F}(Y)$ and $G:\mathbb{F}(Y)\to\mathbb{F}(X)$. It is not hard to see that these are inverses of each other. Hence $\mathbb{F}(X)\simeq\mathbb{F}(Y)$.
"$\Rightarrow$" Since $\mathbb{F}(X)\simeq\mathbb{F}(Y)$ then $\mathbb{F}(X)_{ab}\simeq\mathbb{F}(Y)_{ab}$ where $G_{ab}:=G/[G,G]$ is group abelianization. It is well known that $\mathbb{F}(X)_{ab}\simeq\bigoplus_{x\in X}\mathbb{Z}$, see here. And so we reduced the claim to: if $\bigoplus_{x\in X}\mathbb{Z}\simeq \bigoplus_{y\in Y}\mathbb{Z}$ then $|X|=|Y|$.
Note that we now deal with $\mathbb{Z}$-modules, and group homomorphism $\bigoplus_{x\in X}\mathbb{Z}\to\bigoplus_{x\in X}\mathbb{Z}$ are actually $\mathbb{Z}$-homomorphisms. We further reduce the problem by tensoring both sides with $\mathbb{Q}$ to obtain $\bigoplus_{x\in X}\mathbb{Q}\simeq \bigoplus_{y\in Y}\mathbb{Q}$.
Again $\mathbb{Z}$-homomorphisms $\bigoplus_{x\in X}\mathbb{Q}\to\bigoplus_{y\in Y}\mathbb{Q}$ are actually $\mathbb{Q}$-linear maps. Now the standard linear algebra applies: vector spaces are uniquely determined (up to isomorphism) by the dimension. $\Box$