It's hard to say what is a really bad film to a beautiful score (although William here came up with an almost unequivocal winner), myself I spontaneously came up a little while ago with an example list of memorable soundtracks from comparatively unmemorable films; but for this post, let's see what we can do:
"Airplane" and "Top Secret" (as a young boy and teenager - respectively, I laughed heartily) Zucker slapsticks - Maurice Jarre
"Bitter Moon" (it wouldn't fail that much if it wasn't trying that hard to be artsy - each to their own I suppose) - one of Vangelis' best
A host of Mel Brooks films (not all) - John Morris (wonderful, widely underestimated composer)
"Gremlins", "The Legend", "The Final Conflict" (one of his very best!) - Jerry Goldsmith (most Oscars for Best Music for Bad Films)
"On Her Majesty's Secret Service" (not even Savalas could save it, or for that matter) - John Barry
+ many many others BUT by far and away, for the cornerstone of qualitative disparity between film and its music for me (I know most of you will disagree as vehemently as I purport it)...
...And the winner is....
"E.T." (I hated it as a young teenager then, I hate it even more now. The quintessential exercise in kitsch, banality, and forced tear-jerking... Maybe if I were American I could relate more to it although other Europeans did. For me, had it been any other composer scoring it....) - John Williams.