The recently discovered $X$(3872) has many possible interpretations. We study the production of $X$(3872) with PANDA at GSI for the antiproton-proton collision with two possible interpretations of X(3872). One is as a loosely-bound molecule of $D$-mesons, while another is a 2P charmonium state $chi_{c1}$ (2P). Using effective couplings we are able to give numerical predictions for the production near the threshold and the production associated with $pi^0$. The produced $X$(3872) can be identified with its decay $J/psi pi^+pi^-$. We also study the possible background near the threshold production for $X(3872) to J/psi pi^+pi^-$. With the designed luminosity $1.5{rm fb}^{-1}$ per year of PANDA we find that the event number of $pbar p to J/psi pi^+pi^-$ near the threshold is at the order of $10^6 sim 10^8$, where the large uncertainty comes from the total decay width of X(3872). Our study shows that at the threshold more than about 60% events come from the decay of X(3872) and two interpretations are distinguishable from the line-shape of the production. With our results we except that the PANDA experiments will shed light on the property of X(3872).