What kind of sensor I can use to identify which fruit it is (like mango or apple). Moreover, is there any sensor to identify different varieties of apples or mangoes.
To answer your question I can think of at least: RGB camera, NIR camera, laser scanner.
What you do with the sensors is much more difficult, for example, you have an RGB image of a mango fruit on a tree, how do you find which pixels are mango and which are not (e.g. tree, sky, ground). This is an ongoing research topic in computer vision and agricultural robotics. Some papers show results under controlled conditions (in a lab) or semi-controlled (using assumptions, shading and controlled lighting).
It really depends on the assumptions you can make, then you can match by colour, size and visual texture, amongst other properties.