Some kids are even coached that when far behind in material, instead of resigning, your last trick will be to sacrifice your last few pieces and walk your king into the middle, hoping for stalemate... this works more often than you might expect.
is it correct to resign as a beginner if you’re losing badly?

I see a lot of kids who have only losses and draws until there is a premature resignation.
I want them to learn how to checkmate.
http://chessskill.blogspot.com/2021/11/learning-checkmate-or-teaching-it.html
If a player has two queens and four moves have been played since the second one appeared, presume the player does not know how to checkmate. Never resign to such a player.
Mate in four.
A lot of players would settle for the obvious mate in 5, however.
Yes. That would be fine, too.
My reason for bringing it up is that beginners often cannot find mate in twenty. Resignation to such players is foolishness.