You can get more information by searching for threads that already exist (written by people far more knowledgeable than I am), but the quick answer is this:
Family medicine trains you in the care of adults and children, as well as some ob-gyn, whereas internal medicine will train you in caring for adults only.
Depending on where you practice will dictate the scope of your practice as a family medicine physician- for example, in big cities that are saturated with many providers, family medicine doctors usually don’t see ob-gyn patients; people needing those services will see an ob-gyn. More rural and/or underserved areas may utilize a different practice model, but again, there are other threads about this that contain way more than I know.
At the end of the day, however, the majority of your training in a family medicine residency will train you to practice outpatient, primary care medicine. The vast majority of hospitalists are IM trained. Yes, I am sure there are anecdotal stories of FM-trained hospitalists, but this is not the case for the most part. If you are pretty sure you want to spend at least some time as a hospitalist, FM is not the best choice as a residency.
As far as IM goes, yes, the tracks can prepare you somewhat differently. If you choose a primary care track in IM, you’ll typically have more outpatient/ambulatory time than people in traditional tracks, but it’s usually during the time you’d normally have elective, so lots of times, PC-IM tracks still offer the same amount and caliber of inpatient training as the traditional track. However, you have less elective time (which people usually use to explore subspecialties and/or work on research projects, both of which are preparation for fellowship application). Again, I’m sure you can find anecdotal stories of people who did a PC-IM track and went on to get into a cardiology fellowship, but it’s still not a plan to count on. At my institution, they suggest not doing the PC track if you’re unsure about pursuing a fellowship in the future. Nonetheless, if you do a PC track in IM, you can do what some physicians do, and have a primary care practice but still spend some months of the year attending as a hospitalist.
Traditional IM will leave you the most options. From here, you can go on to subspecialize or become a generalist (inpatient and/or outpatient).
Hope this helps. Use the search function at the top of the page for more information on FM vs IM, training as a hospitalist, training to be a PCP, etc.
good luck!