Hi Bert and welcome to the forum.
Good plan to work on
repair and
maintenance skills if you plan to go sailing to
remote places. You may have heard the definition of cruising as doing boat repair in exotic places. While there's a lot more to cruising than
maintenance and repair that is certainly a significant and important aspect of the life.
And to answer your question, absolutely you can learn a lot of the skills that would help you on a boat. You already mentioned diesels and yes the basic
engine is about the same whether in a truck or a boat. In fact very many of the boat engines are just marinized versions of truck or tractor engines. The main difference is the
cooling. In a boat it's all
water cooled, no radiator so a bit more
plumbing. Which brings up the next skill.
Boat
plumbing is a little different than home plumbing. Usually no PVC or copper pipes and you have a
pump to move the
water around instead of pressure in the pipe. Otherwise you have sinks, faucets, showers and all the same stuff.
Electric can be a biggy and is a mystery to a lot of boaters. The heart of most
boats is 12V DC which works about the same as a cars 12V battery/alternator system. Learn car stuff and you're 90% of the way to boat DC. 120V AC is about like it is on a house with a few extra
safety issues.
Carpentry is carpentry. Main difference on a boat is there are almost no straight lines so you'll be doing a lot of compound curves.
Of course it doesn't hurt to get hands on practice on a real boat. If you like you can come to my boat and do some repairs and I'll only charge you a little for the lessons.