The new mesons $X(3940)$ and $X(4160)$ have been found by Belle Collaboration in the processes $e^+e^-to J/psi D^{(*)}bar D^{(*)}$. Considering $X(3940)$ and $X(4160)$ as $eta_c(3S)$ and $eta_c(4S)$ states, the two-body open charm OZI-allowed strong decay of $eta_c(3S)$ and $eta_c(4S)$ are studied by the improved Bethe-Salpeter method combine with the $^3P_0$ model. The strong decay width of $eta_c(3S)$ is $Gamma_{eta_c(3S)}=(33.5^{+18.4}_{-15.3})$ MeV, which is closed to the result of $X(3940)$, therefore, $eta_c(3S)$ is a good candidate of $X(3940)$. The strong decay width of $eta_c(4S)$ is $Gamma_{eta_c(4S)}=(69.9^{+22.4}_{-21.1})$ MeV, considering the errors of the results, its closed to the lower limit of $X(4160)$. But the ratio of the decay width $frac{Gamma(Dbar D^*)}{Gamma (D^*bar D^*)}$ of $eta_c(4S)$ is larger than the experimental data of $X(4160)$. According to the above analysis, $eta_c(4S)$ is not the candidate of $X(4160)$, and more investigations of $X(4160)$ is needed.