I don't know how much more straightforward I can make this.
Unless a feat's prerequisites say otherwise, the feat's prerequisites must be met—not met occasionally but not right now but actually met—to take a feat, even in the case of feats with the type monster. The raw ability to cast the spell fly does not itself grant a fly speed, so just being able to cast the spell fly doesn't meet the prerequisite for the feat Flyby Attack.
Carefully timing level advancement (as described in answers to this question and this question) so that the spell fly is active when the character gains a level that entitles the character to a feat—so that the character has an actual fly speed when he advances—allows the character to meet the Flyby Attack feat's prerequisite and take the feat, but such careful timing is difficult and the practice is unusual and the idea should be cleared with the GM before marrying it.
However, game balance is not likely to be disrupted were the GM to allow a creature that can only fly under special circumstance to take anyway the feat Flyby Attack. It's an okay feat, but unlikely to be horribly overpowered in the hands of a caster that can already cast the spell fly.
In pathfinder, with regard to monster feats, it appears, if your character has a class or other source that qualifies (such as the power to fly) for the feat, unless the GM specifically makes a house rule against it, you can take it. The Eagle Shaman Druid can take it for instance.
As a GM, I personally would require you to have experience with the fly spell first, and attacking while flying, but that's my own personal house rule, and not RAW.
This may be an overly pedantic reading of the fly spell, but it does not explicitly grant the target a fly speed, which is the prerequisite of Flyby Attack.
As such, I would rule that no you cannot, unless you have some other means of generating a fly speed for yourself.