The observation of a radioactively powered kilonova AT~2017gfo associated with the gravitational wave-event GW170817 from binary neutron star merger proves that these events are ideal sites for the production of heavy $r$-process elements. The gamma-ray photons produced by the radioactive decay of heavy elements are unique probes for the detailed nuclide compositions. Basing on the detailed $r$-process nucleosynthesis calculations and considering radiative transport calculations for the gamma-rays in different shells, we study the gamma-ray emission in a merger ejecta on a timescale of a few days. It is found that the total gamma-ray energy generation rate evolution is roughly depicted as $dot{E}propto t^{-1.3}$. For the dynamical ejecta with a low electron fraction ($Y_{rm e}lesssim0.20$), the dominant contributors of gamma-ray energy are the nuclides around the second $r$-process peak ($Asim130$), and the decay chain of $^{132}$Te ($t_{1/2}=3.21$~days) $rightarrow$ $^{132}$I ($t_{1/2}=0.10$~days) $rightarrow$ $^{132}$Xe produces gamma-ray lines at $228$ keV, $668$ keV, and $773$ keV. For the case of a wind ejecta with $Y_{rm e}gtrsim0.30$, the dominant contributors of gamma-ray energy are the nuclides around the first $r$-process peak ($Asim80$), and the decay chain of $^{72}$Zn ($t_{1/2}=1.93$~days) $rightarrow$ $^{72}$Ga ($t_{1/2}=0.59$~days) $rightarrow$ $^{72}$Ge produces gamma-ray lines at $145$ keV, $834$ keV, $2202$ keV, and $2508$ keV. The peak fluxes of these lines are $10^{-9}sim 10^{-7}$~ph~cm$^{-2}$ s$^{-1}$, which are marginally detectable with the next-generation MeV gamma-ray detector emph{ETCC} if the source is at a distance of $40$~Mpc.