Sugar (sucrose) is a covalent compound, meaning it consists of atoms held together by shared electrons. The intermolecular forces in sugar are van der Waals forces. Van der Waals forces are weak attractive forces that occur between all molecules. They are caused by fluctuations in the electron cloud of a molecule, which create temporary positive and negative charges.
Ammonia (NH3) is a polar covalent compound, meaning it has a permanent positive end and a permanent negative end. The intermolecular forces in ammonia are hydrogen bonds. Hydrogen bonds are much stronger than van der Waals forces. This stronger attraction between molecules is why ammonia has a lower melting point and boiling point than sugar. Hydrogen bonds cause the molecules in ammonia to be more strongly attracted to each other, making it harder to break them apart.
In summary, sugar has weaker van der Waals forces between its molecules, while ammonia has stronger hydrogen bonds between its molecules. This difference in intermolecular forces leads to different physical properties, such as melting points and boiling points.