It is a well-known result that if a ring $R$ satisfies $a^2=a$ for each $a\in R$, then $R$ must be commutative. See here for proof.
I am wondering whether the same result holds for finite rings if we only assume sufficiently many (but not necessarily all) elements of the ring are idempotents. Recall that an element $a\in R$ is called idempotent if $a^2=a$. For example, suppose $R$ is a finite ring in which at least $80$% elements are idempotents. Can we conclude that $R$ is commutative? More generally,
Does there exist an absolute constant $0<k<1$, such that whenever a finite ring $R$ satisfies $$\frac{\textrm{Number of idempotents}}{|R|}\ge k$$ then $R$ is commutative.
Motivation: We know that if every element of a group $G$ satisfies $a^2=1$, then $G$ must be abelian. This is a relatively easy exercise. However, it turns out that we only need 75% percent of elements to satisfy $a^2=1$ in order force $G$ to be abelian. See here. For reference, $a\in G$ is called involution if $a^2=1$.
The other answer is getting large and difficult to edit; furthermore it turns out that the extra observations in the edits aren't necessary.
First let's introduce some useful terminology. The idempotent density of a finite ring $R$ is the number of idempotents in $R$ divided by $|R|$.
Theorem: Let $R$ be a finite ring with idempotent density strictly greater than $\frac{3}{4}$. Then $R$ is commutative, and in fact is isomorphic to $\mathbb{F}_2^n$ for some $n$.
Proof. Since more than $\frac{3}{4}$ of the elements of $R$ are idempotent, more than $\frac{1}{2}$ of the elements of $R$ have the property that $a$ and $a + 1$ are simultaneously idempotent. Hence $(a + 1)^2 = a^2 + 2a + 1 = a + 2a + 1 = a + 1$, so $2a = 0$. The set of elements satisfying $2a = 0$ is an additive subgroup of $R$ and hence has order dividing $|R|$, but a divisor larger than $\frac{|R|}{2}$ can only be equal to $|R|$. It follows that $R$ has characteristic $2$.
Suppose that $R$ has a nontrivial idempotent $a$ (not equal to $0$ or $1$). Consider its centralizer or commutant $\{ b \in R : ab = ba \}$. Since greater than $\frac{3}{4}$ of the elements of $R$ are idempotent, greater than $\frac{1}{2}$ of the elements of $R$ have the property that $b$ and $a + b$ are simultaneously idempotent. But then
$$(a + b)^2 = a^2 + ab + ba + b^2 = a + ab + ba + b = a + b$$
hence $ab + ba = 0$, hence $ab = ba$. It follows that the centralizer of $R$ has order greater than $\frac{|R|}{2}$. As above, since the centralizer is an additive subgroup, it also has order dividing $|R|$, so must be all of $R$. We conclude that $a$ is central.
But since $a$ is arbitrary, it follows that every idempotent in $R$ is central. Moreover, any central idempotent $a$ of a ring $R$ gives rise to a direct product decomposition
$$R \cong aR \times (1-a)R$$
and $aR$ and $(1-a)R$ inherit the property that every idempotent is central. Keep taking direct product decompositions until we have written $R$ as the direct product of indecomposable rings $R_i$ (rings not admitting a nontrivial direct product decomposition; equivalently, rings with no central idempotents). Since all of these rings also have the property that every idempotent is central, they have no nontrivial idempotents, hence have exactly $2$ idempotents. But since idempotent density is multiplicative under direct products and $R$ has idempotent density greater than $\frac{2}{3}$, each $R_i$ must have only $2$ elements, and the conclusion follows. $\Box$
(There is an arguably cleaner way to write this argument: assume $R$ is the smallest counterexample and then derive a contradiction, since either $aR$ or $(1-a)R$ is a smaller counterexample.)