What should I do if my advisor is replacing me with younger, more energetic masters students? I was working on a project with my PhD advisor that was going kind of slowly.  Now he has hired two masters students to "help" me.  They are better at coding than me and seem a lot more interested in and involved with the project than I am.  What should I do?  This is my only project with my advisor and I think he doesn't think I'm very smart.
I think he doesn't think I'm very smart.


More probaby, instead, he just thinks that you're not enough committed to your project. In fact, you write (bold mine):


  They are better at coding than me and seem a lot more interested in and involved with the project than I am.


You are a PhD student and this is your project, and you should be the one who boosts the project with work, ideas and enthusiasm: how come that these two students seem a lot more interested in and involved with the project than you?! 

So, take the bull by the horns and be the booster of your project. Otherwise, it's time you rethink about your motivation in doing a PhD, about your interest in this specific project, and about your future goals. And talk to your advisor.