Problems Linking the max value of an attribute in a table to its primary Key
Maybe you need simple

select count( distinct z.item_id) f, z.order_id as g 
from  Order_item z, /* Item i, */ Ordert o
where o.order_id=z.order_id 
group by z.order_id
order by f desc limit 1


?