Remember boats are not like cars that may get used every day and accumulate thousands of miles in a couple of years. Boats are used less frequently and in a sailboat the engine is used even less as the primary method of propulsion are the sails and the wind. It is not uncommon to find 30 year old engines in very good shape. The use of a marine engine is measured in hours and a diesel engine can easily go 10,000 hours before requiring a rebuild. A visual inspection of the engine can tell a lot, check for rust which can result from water leaks through failed gaskets, look for oil whcih may be leaking again from gaskets. A recently painted engine could be hiding some leaks and thoroughly dirty engine is usually the result of poor maintenance. Yanmar engines rely solely on cylinder compression to heat the fuel to its ignition temperature. An engine with good compression will start right away within the first two or three revolutions while one with lesser compression may have to turn a few more times. Check for smoke after the engine reaches operation temperature, if the rings are worn you may see a white-bluish smoke coming from the exhaust. Run the engine up in neutral through its RPM range and then making sure the boat is well tied put it forward gear and again run the engine through its RPM range. Listen for engine misses or rough running. If there are marked differences on how the engine runs between neutral and under load then the motor mounts or shaft alingment could be responsible. Check the engine control panel and make sure the buzzer and warning lamps are working properly. When you first turn the key the oil pressure light and battery charging light and the buzzer should go on. There is toggle switch to test the lamp for Temperature but you do that once the engine is running. After the engine starts the lamps and buzzer should go off. After the engine is ran for a while and you shut it off leave the key switch on and wait for the buzzer alarm indicating the oil pressure has dropped. In a good engine that should happen within a second or two but if there is significant delay in triggering the buzzer that would be an indication of real heavy oil being used to perhaps mask the effects of an engine that has lost compression and would be burning a thinner oil. Understand that in the condition of the sails and the condition of the engine you are probably looking at 80% of the purchase price. You can tell a lot from a cold start so ask the seller not to start the engine until you get there. When you take a sail test observe how the engine runs and if it is fairly smooth with power then you may likely have a good one.