If you search for ‘new user of the month’ you will find quite a bit of information about the badge. If the badge is enabled, it is granted to two users every month. It is granted to the two users who registered on the site within the past month who have the highest score. The score is based on how many likes the users received for their posts and how many posts the users created. Likes are weighted by the trust level of the users who have liked the posts. This means that likes created by Trust Level 3 and admin users will be weighted more heavily than likes created by new users.
The code that’s used for calculating the score is here: https://github.com/discourse/discourse/blob/master/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb#L37.