The gender of the baby is randomly selected. Sometimes you will see a run of 3 or 4 or more generations of girls, or boys, but eventually you'll get a baby of the other gender.
In many of the older versions, there was a way to determine what gender your tamagotchi would be ( Some sort of an AABBAACC code). Unfortunately, in Music star, this cannot be done. What I did, was if it it your first generation, i just kept resetting the console until a baby boy hatched from the egg. :furawatchi: