We study the single-transverse spin asymmetry for open charm production in the semi-inclusive lepton-hadron deep inelastic scattering. We calculate the asymmetry in terms of the QCD collinear factorization approach for $D$ mesons at high enough $P_{hperp}$, and find that the asymmetry is proportional to the twist-three tri-gluon correlation function in the proton. With a simple model for the tri-gluon correlation function, we estimate the asymmetry for both COMPASS and eRHIC kinematics, and discuss the possibilities of extracting the tri-gluon correlation function in these experiments.