Is it a good idea to train your muscles during puberty?

Form first. Attempts to gain muscle in an immature body can lead to injuries and frustration. Hormonal changes that occur during puberty set the stage for building more lean muscle once puberty is completed. Prior, or during this time, it is better to focus on learning and executing weightlifting exercises with proper form using a PVC pipe or lightweight empty bar.
Yes but! Muscle training before all the hormones of adulthood are present does little to improve strength but can significantly improve neuromuscular skill and coordination. Don't expect to build real bulk until the natural testosterone appears on the scene!