Crop productivity prediction and recommendation is a significant research area of smart agriculture. This paper proposes an Internet of Things (IoT) framework based on dew computing, edge computing, and federated learning, where soil parameter, weather, and climate data are analysed to predict the crop productivity of a land, and then recommend suitable crop for the land. The dew layer pre-processes and accumulates the received sensor data, and forwards to the edge server. The edge server analyses the sensor data and the climate data, and then forwards the result along with the model characteristics to the cloud for further analysis. The proposed framework is simulated in iFogSim. The theoretical analysis shows that the proposed framework has reduced the delay by 60-70% approximately and power consumption by 70-80% approximately than the conventional IoT-cloud framework. We also observe that the proposed framework has reduced the delay by 12-35% approximately and power consumption by 30-50% approximately than the edge-cloud framework. We compare four machine learning algorithms based on their performance in data analysis in terms of precision, recall, accuracy, and F-Score. We observe that each classifier obtains more than 95% prediction accuracy. An Android application is also proposed for crop recommendation.