  Let $A$ be a residually finite dimensional algebra (not necessarily
associative) over a field $k$. Suppose first that $k$ is algebraically closed.
We show that if $A$ satisfies a homogeneous almost identity $Q$, then $A$ has
an ideal of finite codimension satisfying the identity $Q$. Using well known
results of Zelmanov, we conclude that, if a residually finite dimensional Lie
algebra $L$ over $k$ is almost $d$-Engel, then $L$ has a nilpotent (resp.
locally nilpotent) ideal of finite codimension if char $k=0$ (resp. char $k >
0$). Next, suppose that $k$ is finite (so $A$ is residually finite). We prove
that, if $A$ satisfies a homogeneous probabilistic identity $Q$, then $Q$ is a
coset identity of $A$. Moreover, if $Q$ is multilinear, then $Q$ is an identity
of some finite index ideal of $A$. Along the way we show that, if $Q\in
k\langle x_1,\ldots,x_n\rangle$ has degree $d$, and $A$ is a finite $k$-algebra
such that the probability that $Q(a_1, \ldots , a_n)=0$ (where $a_i \in A$ are
randomly chosen) is at least $1-2^{-d}$, then $Q$ is an identity of $A$. This
solves a ring-theoretic analogue of a (still open) group-theoretic problem
posed by Dixon.
