  N-methylformamide, CH3NHCHO, may be an important molecule for interstellar
pre-biotic chemistry because it contains a peptide bond. The rotational
spectrum of the most stable trans conformer of CH3NHCHO is complicated by
strong torsion-rotation interaction due to the low barrier of the methyl
torsion. We use two absorption spectrometers in Kharkiv and Lille to measure
the rotational spectra over 45--630 GHz. The analysis is carried out using the
Rho-axis method and the RAM36 code. We search for N-methylformamide toward the
hot molecular core Sgr B2(N2) using a spectral line survey carried out with
ALMA. The astronomical results are put into a broader astrochemical context
with the help of a gas-grain chemical kinetics model. The laboratory data set
for the trans conformer of CH3NHCHO consists of 9469 line frequencies with J <=
62, including the first assignment of the rotational spectra of the first and
second excited torsional states. All these lines are fitted within experimental
accuracy. We report the tentative detection of CH3NHCHO towards Sgr B2(N2). We
find CH3NHCHO to be more than one order of magnitude less abundant than NH2CHO,
a factor of two less abundant than CH3NCO, but only slightly less abundant than
CH3CONH2. The chemical models indicate that the efficient formation of HNCO via
NH + CO on grains is a necessary step in the achievement of the observed
gas-phase abundance of CH3NCO. Production of CH3NHCHO may plausibly occur on
grains either through the direct addition of functional-group radicals or
through the hydrogenation of CH3NCO. Provided the detection of CH3NHCHO is
confirmed, the only slight underabundance of this molecule compared to its more
stable structural isomer acetamide and the sensitivity of the model abundances
to the chemical kinetics parameters suggest that the formation of these two
molecules is controlled by kinetics rather than thermal equilibrium.
