Hamsters prefer a diet that consists mainly of high-quality hamster pellets or blocks, along with fresh fruits, vegetables, and occasional treats like nuts or seeds. It's important to provide a balanced diet to ensure their nutritional needs are met. Make sure to research specific foods that are safe for hamsters to eat, as some foods can be harmful to them.