How the nuclear force behaves in cluster states, in particular those consisting of the $alpha$ clusters, has been investigated so far, but not yet elucidated. Today the chiral effective field theory is established and it would shed new light on the microscopic understanding of the cluster states. We aim to address a possible source of the attraction in the cluster states of $^8mathrm{Be}$ in view of the pion exchange. Namely, we investigate whether the two-pion-exchange interaction acts as a dominant attraction in the $alpha+alpha$ system as predicted by a previous work. We describe theoretically the cluster structure of $^8mathrm{Be}$ by the Brink model, for which the effective interaction is designed from the realistic nuclear force derived through the chiral effective field theory. The two-body matrix elements of the chiral interaction with the local-Gaussian bases are formulated within the approximation of the spin-isospin saturation forming an $alpha$ particle. Introducing a global prefactor to the chiral interaction phenomenologically, the ground and low-lying excited states of $^8mathrm{Be}$, the scattering phase shift of the $alpha$-$alpha$ system as well, are satisfactorily depicted. The attraction in the cluster states is found to be stemming from the two-pion-exchange contributions dominantly, along with nonnegligible short-range terms. The present work can be the foundation towards constructing realistic cluster models, by which the cluster states will be revealed microscopically in the next step.