  A search for heavy neutral lepton ($N$) production in $K^+\to e^+N$ decays
using the data sample collected by the NA62 experiment at CERN in 2017--2018 is
reported. Upper limits of the extended neutrino mixing matrix element
$|U_{e4}|^2$ are established at the level of $10^{-9}$ over most of the
accessible heavy neutral lepton mass range 144--462 MeV/$c^2$, with the
assumption that the lifetime exceeds 50 ns. These limits improve significantly
upon those of previous production and decay searches. The $|U_{e4}|^2$ range
favoured by Big Bang Nucleosynthesis is excluded up to a mass of about 340
MeV/$c^2$.
