We have used the dynamically constrained phase space coalescence model to study the production of the exotic state $X(3872)$ based on the hadronic final states generated by the parton and hadron cascade model (PACIAE) with $|y| < 7.5$ and $p_T < 15.5$ GeV/c in $pp$ collisions at $sqrt{s}=7$ and 13 TeV, respectively. Here the $X(3872)$ is assumed to consist of bound state $Dbar {D^*}$, which can form three possible structures for the tetraquark state, the nucleus-like state, and the molecular state. The yields of three different structures $X(3872)$ were predicted. The transverse momentum distribution and the rapidity distribution of three different structures $X(3872)$ are also presented. Sizable difference can be found in the transverse momentum and rapidity distributions for the three different $X(3872)$ structures.