  Let $F$ be a totally real number field and $A/F$ a principally polarized
abelian variety with real multiplication by the ring of integers $\mathcal{O}$
of a totally real field. Assuming $A$ admits an $\mathcal{O}$-linear 3-isogeny
over $F$, we prove that a positive proportion of the quadratic twists $A_d$
have rank 0. We also prove that a positive proportion of $A_d$ have rank $\dim
A$, assuming the Tate-Shafarevich groups are finite. If $A$ is the Jacobian of
a hyperelliptic curve $C$, we deduce that a positive proportion of twists $C_d$
have no rational points other than those fixed by the hyperelliptic involution.
