Kids naturally want to do well and gain the approval of others. If they're not doing well or seem unmotivated, look for the obstacles that may be getting in the way.
It could be something technical (for example at school, they need glasses, a better spot for homework, a way to organize their assignments). Or it could be emotional (they're struggling with a subject and feel inadequate, their teacher seems judgmental, they're preoccupied with big emotions about something else, or they're bored or not getting enough time to do what *they* want). Or it could have to do with executive functioning and energy (they need a snack, or to do homework earlier in the day).
Approach your child with curiosity and seek non-judgmentally to figure out what's getting in the way. You could try drawing out a journey map of their day or their process around homework, and spot together where the pitfalls lie. Validate their reality around this and empathize with their feelings, and then problem solve together.
Apart from improving the issue at hand, this will build your connection and trust together!