What is the best time to start UPSC preparation for a B.Tech student?
There is no specific time to start with it. You can start preparing for right away along with your engineering. Some also start with UPSC preparation after settling in their respective jobs. So it purely depends on you
Almost everyone I know who's successfully cracked UPSC began their preparation early on and cracked it in their ~3rd attempt.
This means that depending upon your level of preparation, you should start right away and get an overall picture of the kind of preparation you'll need to crack UPSC.
However, at the same time, do NOT let your B.Tech studies suffer. You must maintain 60% + performance throughout all the exams. I'd say focus more on engineering exams than your UPSC preparation; because UPSC is super difficult to crack.
I'll also recommend that you should join a coaching institute so that there's discipline in your preparation. But if things don't to the way you want; you must have a good fallback.
Most of the companies recruit candidates with at least 60% in engineering; and if UPSC does not work out for you; you must be eligible for majority of the MNC jobs available.
Start early, and maintain consistency. All the best!