Cosmology is the study of the universe comprising stars and galaxies. Advancement in the telescope has made it possible to capture high -resolution images, which can be analysed using machine learning (ML) algorithms. This paper classifies the star galaxy dataset into two classes: star and galaxy using ML algorithms and compares their classification performance. It is observed that random forest provides better accuracy of 78\% as compared to other ML classifiers. Further to improve the classification accuracy, we proposed a CNN (Convolution Neural Network) model and achieved an accuracy of 92.44\%. Since the CNN model itself extracts the characteristics, it exhibits superior classification accuracy.