Why do propeller airplanes mostly have their propellers in front (of the fuselage or wings) while ships and boats mostly have them at the back?
I realize that there are aircraft with pusher configurations but they are relatively rare.
There are quite a lot of reasons for this, but it's a complicated design environment, and that's why it's not always the case.
Seals and cooling
The inside of a plane's wings is the same fluid as the air around it, but the inside of a boat's hull is a different phase than the water outside. Basically you can never have a rotating shaft over a pressure difference that doesn't permit some fluid through, around the shaft. There are ways to mask this, so that no one ever sees water leaking into the hull. For instance, you can have an intermediate stage between the hull and the water where air is pumped into a higher pressure cavity. Then it's possible that the seal can bubble with air passing out into the water.
Whichever design the ship maker uses you can't change the physical fact that you'll have some fluid flow through the prop seals, be that air or water. This presents a good reason to have the prop on the back of boats and the front of planes. Pressure is higher at the front because of the kinetic pressure of the fluid, and lower at the back for the reverse reason. By putting the prop of a boat in the back you reduce the pressure difference that the seals have to deal with. The plane has no such concern, and might prefer more air pressure and flow around its engines for cooling. In fact, Wikipedia seems to agree with the cooling point for plane engines.
A moving boat or plane has an aerodynamic center of pressure. If this point is behind the point of thrust, then it's a more stable setup and if it's in front then it's a less stable setup. It's likely not a problem either way because there are other dynamical factors that make it stable, or you have a pilot that acts as an active control system.
Nonetheless, planes worry about stability a lot more than boats.
As others have pointed out, boats logically don't want the prop in the front because you're more likely to hit something (like a sandbar) with the front of the boat, and you don't want to shred things. This quite possibly dwarfs the basic physical considerations.
In fact, as I was thinking about cavitation concerns, it seems clear that the back of the boat isn't the ideal place. Directly under the hull would be superior. But this a) doesn't give a direct shaft line to the engine and b) it could make the prop hit the ground or a whale. For this case, it's clear that the operational safety concerns are much more pressing than a little bit more performance.
Well the issue is relatively simple.
With the boat, all that is required is to propel the boat forward, and that is best achieved by accelerating a mass of water in a direction opposite to the direction of boat travel. That is best achieved by expelling the accelerated water into as unrestricted a space as possible; which clearly is behind the boat. With the propeller in front, the accelerated water has to move around the bow of the boat, so part of the energy is wasted moving the water sideways, away from the hull, and generating no net thrust since the two sides cancel out, so only the component of the velocity along the path of travel is useful in driving the boat.
With an aero-plane, there is an additional interest, namely increasing the lift of the wing, specially at low forward speeds such as at take off and landing. So having the propeller in front, (specially with twins) even at zero speed, the air flow over the wings, provides significant lift, reducing the necessary take off speed, and the possible landing speed. The plane propeller, even with a single engine, has a larger diameter, than the profile of the fuselage, and the propeller is designed so that most of the air movement is generated near the tips, rather than at the hub, so the energy lost to the fuselage drag is minimal.
Pusher propeller planes, or push-pull duals, are quite popular when used on primitive air strips, that may have loose stones on them, so the prop wash is not kicking up stones into the fuselage.
A boat is most efficient when it is riding on a plane. This happens when the boat reaches a certain speed and is essentially lifted out of the water. This can not happen if the propeller were located on the front of the boat. Look up a boat with a hydrofoil and you can see how it works.
I don't know much about this, but this is my view
In ships and boat's we have propellers at back because water is relatively too much denser the air so if propeller's were fit in front of ship or the boat the turbulence created bu the propeller in the water would create too much drag with the ships hull and make it difficult for the ship to move. The drag in case of ship and water is too high that is why ships are fitted with the baw in front of them to avoid as much drag as possible, whereas in case of plane the propeller are fitted on the wing or in the front of the plane that is obvious as the drag due to air turbulence is not much it is noticeable, however since air is not so dense so the drag due to it's turbulence is not so high so high which can be compensated. But planes have propeller's at back also like this one
For an aeroplane while flying its stability is very important.the heaviest part in a plane are its engines.to get better stability the engines have to be placed in the right place considering its weight distribution of fuel tanks (wings) and cargoes and seating.that is why it is not just in the front it is placed in the right place as its center of mass.few planes even have 3rd engine placed just front of its tail to equalise the weight distribution.but for a ship it pretty much stable in water as it floats.the engines are used for propulsion thrust.its turbulant flow behind engines creates a drag causing it to reduce its speed if it were in the front.also it makes ships to steer the ship easier if its at the rear instead of middle or front with the help of tail or diverter.