Magnetic field inside the solenoid is due to the current carrying circular turns.
At the centre contribution of the each side of the solenoid is same and net field is added up but at the end , different parts of the solenoid has different contribution.We know magnetic field due to the circular loop decreases as we go away from the centre along the axis.
Therefore, magnetic field dec. when we go towards the end of the solenoid.