  Axion-like particles (ALPs) coupled to nucleons can be efficiently produced
in the interior of protoneutron stars (PNS) during supernova (SN) explosions.
If these ALPs are also coupled to photons they can convert into gamma rays in
the Galactic magnetic field. This SN-induced gamma-ray burst can be observable
by gamma-ray telescopes like ${\textit Fermi}$-LAT if the SN is in the field of
view of the detector. We show that the observable gamma-ray spectrum is
sensitive to the production processes in the SN core. In particular, if the
nucleon-nucleon bremsstrahlung is the dominant axion production channel, one
expects a thermal spectrum with average energy $E_a \simeq 50$ MeV. In this
case the gamma-ray spectrum observation allows for the reconstruction of the
PNS temperature. In case of a sizable pion abundance in the SN core, one
expects a second spectral component peaked at $E_a\simeq 200$ MeV due to axion
pionic processes. We demonstrate that, through a dedicated LAT analysis, we can
detect the presence of this pionic contribution, showing that the detection of
the spectral shape of the gamma-ray signal represents a unique probe of the
pion abundance in the PNS.
