Clusters of galaxies have not yet been detected at gamma-ray frequencies; however, the recently launched Fermi Gamma-ray Space Telescope, formerly known as GLAST, could provide the first detections in the near future. Clusters are expected to emit gamma rays as a result of (1) a population of high-energy primary and re-accelerated secondary cosmic rays (CR) fueled by structure formation and merger shocks, active galactic nuclei and supernovae, and (2) particle dark matter (DM) annihilation. In this paper, we ask the question of whether the Fermi telescope will be able to discriminate between the two emission processes. We present data-driven predictions for a large X-ray flux limited sample of galaxy clusters and groups. We point out that the gamma ray signals from CR and DM can be comparable. In particular, we find that poor clusters and groups are the systems predicted to have the highest DM to CR emission at gamma-ray energies. Based on detailed Fermi simulations, we study observational handles that might enable us to distinguish the two emission mechanisms, including the gamma-ray spectra, the spatial distribution of the signal and the associated multi-wavelength emissions. We also propose optimal hardness ratios, which will help to understand the nature of the gamma-ray emission. Our study indicates that gamma rays from DM annihilation with a high particle mass can be distinguished from a CR spectrum even for fairly faint sources. Discriminating a CR spectrum from a light DM particle will be instead much more difficult, and will require long observations and/or a bright source. While the gamma-ray emission from our simulated clusters is extended, determining the spatial distribution with Fermi will be a challenging task requiring an optimal control of the backgrounds.