Let's assume
total number of students in Ashley's class is x
25% of total number of students prefer pizza the most
so, number of student prefer the most is 25% of x

we have
number of student prefer pizza the most is 6
so, we can set them equal

now, we can solve for x
we get

so, total number of students is 24...........Answer