Why is the mechanical energy of a free falling object conserved? My textbook says that in an isolated system (when there is no external force and the internal forces are conservative)the mechanical energy of the system remains constant.
It then states the example of a freely falling ball , where the sum of potential and kinetic energy of the ball is always constant.
But if we consider the ball as the system, then we have an external force (gravity) acting on the system, then why is the mechanical energy constant in this case?
 A: The ball alone does not possess gravitational potential energy (GPE). GPE is a property of the ball-earth system. Therefore mechanical energy is conserved for the ball-earth system, not the ball alone.

So if I take the ball as the system, then the mechanical energy is not
  conserved, right?

Correct. The ball increases kinetic energy but no where in the system (the ball alone) is there a corresponding decrease in potential energy (of any kind).  Or, to put it another way, the ball acquires kinetic energy because it is not an isolated system, the gravitational force now being considered "outside" the system.
Hope this helps. 
A: In an isolated physical system , the only allowable force is the gravitational force and it is internal to this system. Similarly if the ball is sitting at your desk motionless, you have two forces: the gravitational force and the normal force which trivially cancel but here is another example where some forces are internal to the system.
What is meant here by an external force is a force that does work on the system and therefore alters its energy. Gravity is directly linked to gravitational potential energy which is included in mechanical energy summation. You would need for example something or someone to alter this ball in free fall to violate mechanical energy conservation.Therefore, whenever you think of an isolated system you must include the gravitational force.
Hope that helps!
A: You need to understand this clearly in early stages , it is a very simple situation , if the ball is in free fall it had gravitational potential energy aldready so even before it started to fall it had gained that potential energy , plus it does not make much sense if you just take one object and call it a system ,in this case the ball and the earth form a system . When you say "free fall" you have aldready included earth inside your system
A: Here is a mathematical justification. I will assume a knowledge of some vector calculus, so feel free to ask questions if you have any issues.
Let $\textbf{F}$ represent the (conservative) gravitational force (a vector) at every point in space. Now, imagine that an object begins to fall through this vector field. Assume that the object begins at point $A$ and ends at point $B$.  If $K$ represents the kinetic energy of the free-falling object, then we have that 
\begin{equation}
\Delta K = \frac{1}{2} m (v_b^2-v_a^2) = \int_A^B \textbf{F} \cdot d\textbf{S} \; \; \; (\textrm{i})
\end{equation}
Now, imagine you have some other object at point $A$. You throw this object straight up into the air at some initial velocity $v_A$. You will find that when it comes back down to A, its velocity is $v_A$. That is, when the object takes this specific closed path from $A$ to $A$, $ \: \Delta K = 0$. Indeed, if this object takes any closed path from $A$ to $A$, you will find that $\Delta K = 0$. Hence, by equation (i), we have that
\begin{equation}
0 = \oint \textbf{F} \cdot d\textbf{S} \; \; \; (\textrm{ii})
\end{equation}
As it turns out, equation (ii) means that  means that we can define a "potential energy" function $U$:
\begin{equation}
\textbf{F} = -\nabla U \; \; \; (\textrm{iii})
\end{equation}
Taking the line integral from $A$ to $B$ of both sides of equation (iii) yields
\begin{equation}
 \int_A^B \textbf{F} \cdot d\textbf{S} =  \int_A^B -\nabla U \cdot d\textbf{S} = -U(B)-(-U(A)) = U(A)-U(B) = -\Delta U \; \; \; (\textrm{iv})
\end{equation}
Now, the total mechanical energy $E$ of the system is given by $E = U+K$. That is, $\Delta E = \Delta U+ \Delta K$. By equations (i) and (iv), we have that $\Delta E = 0$. In other words, the mechanical energy of the system remains constant between any two points $A$ and $B$.
