If you have started a healthy habit with plenty of motivation only to watch it fade a few weeks later, the problem may be less about motivation and more about how the habit was designed.
Learning how to build healthy habits that actually stick means making a behavior easy to start, connecting it to a reliable cue, repeating it in a fairly consistent context, and having a realistic plan for disrupted days. Motivation can help you begin, but repetition and good habit design make a behavior easier to maintain.