Although the dementor's kiss is a major turning point at the end of the fourth book, which serves as a premise for Fudge's attitude in the 5th book, the execution itself seems somewhat unnatural and illogical.

At this point the dementors were still under Ministry control and the one with Fudge did not go there of it's own volition, Fudge took it there as a personal body guard.
From Prof. McGonagall's description of the dementor attack, it does not seem like Fudge explicitly ordered the kiss (and moreover, Fudge seems level headed enough to not give such an extreme order, even if he saw an escaped convict in front of him who was presumably dead. Moreover, Barty Crouch Jr. was in no position to harm Fudge or anyone else in that scene).

So what we know of the scene from Prof. McGonagall's description to Dumbledore, is that as soon as the dementor saw Crouch Jr., it swooped down and administered the kiss.

The question is, Why did the dementor do it?

It is not possible that it recognized Crouch Jr., as none of them recognized him when he was smuggled out of the prison.
It went for Crouch Jr. and did not attack anyone else in the room, hence the attack was specifically directed towards him.

One argument that can be given is that when the dementor found Crouch Jr. in the room, possibly he was in such a weakened state that it acted instinctively, seeing him as a natural prey. However, if the dementor was that out of control, I doubt Fudge would have him around as the only personal body guard in the first place.

What exactly was the impetus for the dementor kiss at the end of Goblet of Fire?

3 Answers
3

Dementors are blind, they can sense people but they cannot differentiate one person from another.

But Crouch took another deep breath and continued in the same flat voice.

“The dementors are blind. They sensed one healthy, one dying person entering Azkaban. They sensed one healthy, one dying person leaving it. My father smuggled me out, disguised as my mother, in case any prisoners were watching through their doors.

Harry Potter and the Goblet of Fire, Chapter 35, Veritaserum

This means that the dementor did not recognize Crouch Jr. It basically leaves us with two probable causes for this.

1. Fudge or somebody else in the ministry ordered the kiss

“When we told Mr. Fudge that we had caught the Death Eater responsible for tonight’s events,” said Snape, in a low voice, "he seemed to feel his personal safety was in question. He insisted on summoning a dementor to accompany him into the castle. He brought it up to the office where Barty Crouch -”

“I told him you would not agree, Dumbledore!” McGonagall fumed. “I told him you would never allow dementors to set foot inside the castle, but -”

“My dear woman!” roared Fudge, who likewise looked angrier than Harry had ever seen him, “as Minister of Magic, it is my decision whether I wish to bring protection with me when interviewing a possibly dangerous -”

“By all accounts, he is no loss!” blustered Fudge. “It seems he has been responsible for several deaths’.”

Harry Potter and the Goblet of Fire, Chapter 36, The Parting of the Ways

Fudge knew a death eater responsible for murders has been caught. This would have brought anxiety to people, especially after the events of Quidditch world cup and raise doubts about his leadership skills. So it made sense for him to get rid of Crouch Jr.

“’Course,” said Hagrid. “They wanted Dumbledore fer Minister, o’ course, but he’d never leave Hogwarts, so old Cornelius Fudge got the job. Bungler if ever there was one. So he pelts Dumbledore with owls every morning, askin’ fer advice.”

Harry Potter and the Sorcerer's Stone, Chapter 5, Diagon Alley

But we also know from the books that Fudge is not one of the brightest minds, so there is a probability that somebody else inside the ministry would have ordered the kiss. This is similar to what happen in Harry Potter and the Order of the Phoenix, where an Dementor attacked Harry and Dudley on commands from ministry of magic.

2. Dementor acted on its own accord

Sirius Black mentions that Dementor can sense emotions.

Dementors can’t see, you know...” He swallowed. “They feel their way toward people by feeding off their emotions...

Harry Potter and the Prisoner of Azkaban, Chapter 17, The Servant of Lord Voldemort

Crouch Jr. having spent some time in Azkhaban might have shown emotion like fear which might have attracted the Dementor towards him. Secondly Dementor would have know that person in the room had escaped from Azkaban.

There are two instance in the cannon which have shown that Dementors are not tamed, that they can take action on their own.

Dementor Attacked Harry:

“They’re getting hungry,” said Lupin coolly, shutting his briefcase with a snap. “Dumbledore won’t let them into the school, so their supply of human prey has dried up... I don’t think they could resist the large crowd around the Quidditch field. All that excitement... emotions running high... it was their idea of a feast.”

Harry Potter and the Prisoner of Azkaban, Chapter 10, The Marauder’s Map

Dementor tried to kiss Harry:

“Oh yes, they’ll have to go,” said Fudge, running his fingers distractedly through his hair. “Never dreamed they’d attempt to administer the Kiss on an innocent boy... Completely out of control... no, I’ll have them packed off back to Azkaban tonight... Perhaps we should think about dragons at the school entrance...”

Harry Potter and the Prisoner of Azkaban, Chapter 22, Owl Post Again

This instance looks more like an Dementor taking matters into it's hand.

I believe the primus motor of the execution was Fudge, and his desire to get rid of Crouch as soon as possible prompted the dementor to act. It is possible he had even explicitly ordered the dementor to administer the kiss before entering the scene.

Fudge had a reason to act rashly, because Crouch was a fountain of bad PR. He had escaped Azkaban, unnoticed even, exposing a major blunder on part of the Ministry. This would've been very serious, especially with his father being a high-ranked Ministry official. It's practically screaming "corrupt government coverups". And it gets even worse, for said fugitive also spent a whole year teaching at Hogwarts without anyone noticing - cue outraged parents screaming "Think of the children!"

Also, had Crouch been tried in Wizengamot, there would have been a lot of publicity around not only his botched confinement but also Voldemort's return - something Fudge wanted to avoid desperately. No one wants to be THE Minister under whose term the Wizard Hitler returns.

So he opted to take the easy but corrupt path that became his prime characteristic in Order of the Phoenix: sweep it under the rug and keep up appearances.

We also have the possibility that Dementors know who their real allies are and where their real loyalties should be, and act along those lines. Crediting them with a normal level of intellect explains what we have seen.

Everyone in the wizarding world knows who this Harry Potter boy is; why should the Dementors be any exception? They would see Harry as the last remaining major threat to their true master, and that eliminating him was something they ought to do.

Furthermore, the Dementor who accompanied Fudge into the castle could have gathered from conversations that the prisoner was a Death Eater who had failed, and thus was a great fountain of intel for the master's enemies. Time to stop that leak.