A novel idea is presented in this paper to simulation, design, and feasibility of making a machine in order to produce nitrogen 13 (N-13) at a much lower cost than conventional medical applications. In a plasma focus device, only 0.02% of the generated ions have more than 1 MeV energy. In this paper, using a new idea we have tried to find a solution to increase the energy of deuterium ions to produce N-13. To achieve this, a series of magnetic lenses has been used to focus and guide the ions. To increase the ion energy, a small linear accelerator has been designed using a TM010 waveguide. The accelerator waveguide is also designed and optimized to have the highest impedance matching and maximum power transmission. Eventually, low-energy ions that are transmitted by magnetic lenses accelerate in the waveguide electric field and their energy increases significantly. The collision of these energetic ions with graphite target produce N-13.