Although the second part of the episode (about Ben-Hur and the Queen Class) is in the original novel of Anne of Green Gables, the first part about the poison apple, wasn't. That part is actually a tribute to another novel (Emily of New Moon) written by the same author that wrote Anne of Green Gables, (Lucy Maud Montgomery). It was a chapter of Emily of New moon, and appeared in the episode 6 of the anime version of Emily of New moon.
But it's funny how the Anne of Green Gables anime version on the poisoned apple is much more accurate with that chapter of the original Emily book than the Episode of The Emily of new moon anime. The Anime version of Emily of new moon also does a little tribute on Anne of Green Gables by mentioning Avonlea, because Avonlea wasn't mentioned in none of the three Emily books novels.
Anyway, for those that never saw the anime version of Emily of New moon, you should watch it, it's really good and it was already subbed to English by digital panic.