Actually there's no problem with your code, but you have misunderstood the returned value of String.find(), which will return -1(if not found) or > -1(the starting position of substring).
In your case, it will always return 0 instead of number bigger than 0(since "Dragon" start at position 0), that's why
target.name.find("Dragon") > 0 is always false
Here's how I would code, not necessary, but more readable:
var target = $RayCast2D.get_collider()
if target: # If target not null
if target.name == "Dragon": # If target's name is "Dragon"
if food > 0:
food = food - 1