If the answer to the question above is "Yes"; since Barclaycard allows interest free repayment till 18 months from the date of purchase, should I pay the debt back in shorter (e.g. 6 months) or longer (<= 18 months) term to improve my credit score the most?
Payment history is probably the most significant contributor to your credit score. Having a solid history of making, at least the minimum, payments on time will have a positive impact on your credit score. Whether or not this specific transaction means anything to that equation is up for debate.
If you have no credit lines now and 0% for 18 months on a computer makes sense to you, then yes, making this purchase this way and paying on time will have a positive impact on your credit score. Paying interest doesn't help your credit score. Repay this computer before the 18 month period ends, then be sure to pay your balance in full every month thereafter.