I think failing three classes in ms1 can hurt if it goes in your transcript. Preclinical grades for IM are much less important than clinical grades (especially in IM). What you need to do from now on try not to fail any more courses, just try to sneak by and just get the "p" you need. You can get into a strong IM program without honoring any preclinical courses. Try to work hard for step I and shoot for ~220 or higher. Definitely work hard in your clinical years and get decent grades and LORs. If all else checks out I think the adcoms would be willing to forgive those F's and look at the rest of your app. IM in recent years has become somewhat more competitive than before so getting into an above average academic program will require a decent step I score, clinical grades/evals, lor's. An away rotation at a program of your choice in 4th year can help you tremendously in securing a residency there. Good luck!
Your Step 1/Level 1 score will count for a lot more than your pre-clinical grades. Your best bet is to crush USMLE Step 1 at least - just getting by with the COMLEX may not be an option if you want a moderately competitive IM residency.