It's multifaceted, but part of it is scaring them straight--you're going to go up against an interviewer and not only do you have to convince them you know what you're talking about, you have to do that better than any other candidates who are interviewing.
And--hey--if you want to be $x0,000 in debt with no job prospects, there are faster and easier ways to do that. Why bother coming to class? Just buy an expensive sports car. At least you'll have a nice car to show for it until it gets repossessed.
Another part of it is lesson and project optimization. Overwhelmed students are more likely to cheat. So... is it possible to teach the same topic just as effectively with less time or mental effort requirements? And yes, it often is. Less can be more.
Yet another part is maintaining student engagement by being there for them. I'm lucky enough to teach at a university where class sizes rarely exceed 30, which means I can answer questions in their medium of choice very frequently throughout the day. I try to let them know I'm on their team, and we'll slay this dragon together.
Can ChatGPT solve their programming projects for them? Hell yes. And if not this year, very likely next year. And I know I won't be able to tell the difference between a ChatGPT solution and the solution of a capable student.
The only sensible option is to get them to not want to use it.
Edit: get them not to want to use it to cheat, in particular. It's a pretty powerful tool for figuring things out.