If a Planeswalker transforms into a creature during the main phase, but it is suddenly killed, is it still able to attack?
There's a few small issues here:


Buyback needs to be used while the spell is cast - it's an additional cost so the opponent will pay  for the first casting of clockspinning all at once, not  to cast and then decide to pay  for buyback.
Buyback happens when the spell resolves - the card does not immediately return to hand, but goes to hand instead of grave when it resolves. This means Clockspinning will need to resolve before the opponent can re-cast it. At no point will both copies of clockspinning be on the stack together.


These don't change what happens in the end in this case, but there are cases where it will matter, for instance you don't get the chance to decide to buy back or not after you see if the opponent is countering.

For your actual question, Sarkhan's ability will resolve, but it will do nothing. The order of events and the actions of the Active Player (player) and Non-active Player (opponent) are this:


Player casts Sarkhan, both players pass priority, he resolves and his +1 is activated, putting it on the stack and leaving Sarkhan with 5 loyalty.
Active player passes priority, Non-Active Player casts lightning bolt, targeting Sarkhan.
Non-Active Player keeps priority, Non-Active Player casts clockspinning with buyback, targeting Sarkhan.
Both players pass priority, Clockspinning resolves and removes a counter then returns to Non-Active Player's hand due to the buyback replacement effect.
Active player passes priority, Non-Active Player casts clockspinning without buyback, targeting Sarkhan.
Both players pass priority, Clockspinning resolves and removes a counter then is put into Non-Active Player's graveyard.
Both players pass priority, Lightning bolt resolves, doing 3 damage to Sarkhan, removing the last 3 loyalty counters.
Sarkhan is put into the graveyard under rule 704.5i for having no loyalty counters. This is a state based action and cannot be interrupted.
Both players pass priority, Sarkhan's ability resolves and tries to turn the planeswalker into a creature, however the object that used the ability no longer exists (the card is not in the same zone) so it fails to do anything.


Note how both players pass priority every time something resolves - the whole stack doesn't resolve when both players choose not to use their priority to cast a spell or activate an ability, only the top of the stack resolves and after that each player gets priority again.



As an interesting aside - Sarkhan is unusual among planeswalkers that animate in that he becomes only a creature, not a creature in addition to being a planeswalker. This means he cannot lose loyalty from damage as a creature, however clockspinning can still remove loyalty counters from him. If the last counter was removed from Sarkhan by clockspinning when he was already a creature, he would be able to attack and still on the field until the end of the turn, where he stops being a creature, becomes a planeswalker again and 704.5i puts him into the graveyard. Most of the planeswalkers that turn into creatures (mostly every copy of Gideon) stay planeswalkers while they are creatures, so removing counters from them with clockspinning after animation would still apply 704.5i would kill those immediately.