When the only connection it has with yume nikki are only references and nothing from the gameplay (or even the idea) at all.
There are thousand of games, movies and books about dreams; the fact that in your game they have relevance doesn't make it an insta-fangame, neither it does that is loosely based on the idea of "go to sleep, get some kind of thing like an effect, ok thats it gratz broh". That's just a game with yume nikki's most classical and basic input from the player (effects, dreams) hard-glued onto your game, and to be honest, it feels extremely forced and out of place.
There are fangames that aren't an exact copy of YN since they add great ideas yet they don't deviate themselves too much from the general feeling. For example, The Looking Glass. Yeah, yeah, story, lots of dialog, relevant characters rather than dull non-speaking NPCs, but it still was a pure fangame at its core: simple exploration through an odd world with strange characters, and you could build thousand of theories about why such a thing was possible.
The thing we loved and adored about Yume Nikki wasn't just walking through deep-meaning art w/ scary NPCs and 2deep4u imagery, it was that we could spend hours just THEORIZING why everything was that way. It was discovering that things weren't placed there just to look pretty and make us guess why vomit-chan was so fucked up and then keep moving to the next scene.
In the last years, it feels like most of the newer fangames are just trying to copy the "uh, this is weird and makes me uneasy" feeling rather than trying to build a strongly-based meaning behind why they make their things. Instead of thinking throughfully what they're trying to convey, it feels more like they're trying to appeal the "dark" side of these games fans and they forget what's behind the main stage, which leads to the classical "MC is hikikomori, was abused, possibly raped, bullied, and then proceeds to end their life at the ending".
Now, there are excellent fangames that gave one step forward this idea of meaning-behind-the-scene and "deep teen hikiko" cliché and turned out quite nicely, being Miserere an example. Leaving candy-eye graphics aside, the game was great because you could see how deteriorated was Kenshin-chan's mind due to solitude and how it was slowly developing into a great mess. And even then, the main feeling during the whole game felt really yume nikki-esque.
There was this game >>8833
"You May" that too added news things and was really nice. It's a shame the dev hasn't update ever since then, the game had so much potential.
I think the major problem when it comes to defining whether a game is a fangame or not is that people try to add too much things to what should be a simple-mechanic game and the general feeling and idea is lost. As I said, it feels forced, out of place. At least that's what I think.>>10348
Anon has a point here too, I can literally cuntpaste mado's sprite into touhou 8 and call it 「東方永夜之夢幻」, and shit could be considered a fangame.