Yep this is correct!
Consider the following algebraic characterization of $0$-dimensional rings.
A ring $R$ is $0$-dimensional iff for every $x \in R$ there exists an $n \in \mathbb{N}$ such that $x^{n+1} R = x^n R$
Proof I think you already know the if direction. Conversely, suppose for the sake of contradiction that $x^{n+1} y \not= x^n$ for any $y \in R, n \in \mathbb{N}$. Then in particular the multiplicative set generated by the elements $x, 1-xy$ does not contain $0$. So there's a prime $\mathfrak{p}$ disjoint from this multiplicative set. That would firstly imply $x \notin \mathfrak{p}$, but since the ring is $0$-dimensional by assumption, $\mathfrak{p}$ is maximal and then $x$ is a unit in $R/\mathfrak{p}$, hence $ax - 1 \in \mathfrak{p}$ for some $a \in R$, also a contradiction. $\square$
In your case $a^p = a$, so in fact $a^2R = aR$.
Also note that any $0$-dimensional ring is Hausdorff with respect to the Zariski topology. This is a special case of the fact that
The minimal prime spectrum of a ring is always Hausdorff with respect to the (topology induced by the) Zariski topology.
Proof Indeed, if $\mathfrak{p}, \mathfrak{q}$ are two distinct minimal primes of a ring, then find an element $f \in \mathfrak{p} \setminus \mathfrak{q}$. Since $f \in \mathfrak{p}$, the image of $f \in R_\mathfrak{p}$ is in the nilradical of $R_\mathfrak{p}$, hence there exists $s \notin \mathfrak{p}$ such that $sf^n = 0$ for some $n$. In particular, $\mathfrak{q} \in D(s), \mathfrak{p} \in D(f)$, and $D(f) \cap D(s) = \emptyset$, so we've separated $\mathfrak{p}, \mathfrak{q}$ $\square$.
You can also show that the minimal prime spectrum of a ring is totally disconnected with respect to the Zariski topology. So $0$-dimensional rings are quasi-compact, Hausdorff, and totally disconnected (so yes they are $0$-dimensional as topological spaces too).
As you say, Stone duality assures us that the spectrum of any $0$-dimensional ring can be realized as the spectrum of a Boolean algebra. In particular, we can put a Boolean algebra structure on the idempotents of any ring by defining addition as the map sending $(e,f) \to e + f - 2ef$ (and multiplication inherited from the ring). This is isomorphic to the canonical algebra structure on the clopens of the Zariski topology. Stone duality is telling us that the idempotent algebra associated to a $0$-dimensional ring has the same spectrum as the original ring.
Let $\phi \in \textrm{Hom}(A, \Bbb F_2)$.
Note that if $C \subseteq X$ is clopen, then $\chi_C: X \to \Bbb F_2$ defined by $$\chi_C = \begin{cases} 1 & x \in C\\ 0 & x \notin C\end{cases}$$ is continuous, so that $\chi_C \in A$.
Consider $$\mathcal{F} = \{A \subseteq X\mid A \text{ clopen }, \phi(\chi_A)=1\}$$ and prove that $\mathcal{F}$ is a family of closed subsets of $X$ with the FIP. Compactness (plus Hausdorff, and total disconnectedness) gives us a unique $x \in \bigcap \mathcal F$, and show then that $\theta(x)=\phi$, showing onto-ness.
The link to ultrafilter connection is clear and
this blog post also gives some helpful info.
Best Answer
Try to show that a prime ideal in $R=C(X,\Bbb Z_2)$ corresponds to a unique point in $X$ using compactness. (The sets $\{f^{-1}[\{0\}]: f \in I\}$ form a zero-set filter, when $I$ is an ideal in $R$ etc.)
Then show $\textrm{Spec}(R) \simeq X$ via this correspondence.